Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Per-word "Identity" Value at Serialization/Deserialization #2

Open
dgerding opened this issue Apr 2, 2023 · 0 comments
Open

Comments

@dgerding
Copy link

dgerding commented Apr 2, 2023

Hi,
Thanks for the great writeup and highly functional DAWG.

I wonder if there is a way to infer (?) a unique numeric identity at serialization. For example, is there some value to grab (a numeric representation of path to node as id sequence?) that I could treat as a unique numeric identifier for that string? My goal is to know some unique value that persists both to and from serialization so that I can map a word value to a related data item.

When I ran the File_TapTopTapsTops test, which specifies four entries for the dawg:

var dawg = Dawg.CreateBuilder(new[] {"tap", "top", "taps", "tops"}) .Build();

I expected I would hit the debug breakpoint I put on the modified version of WriteLists in DawgBuilder 4 times, but only hit it twice. I expect that's because I have the wrong mental model of the encoding.

But what I was hoping for was to find some form of "per word numeric identity" in the graph, lurking at the moment of serialization.

` void WriteLists(Queue pending, LongestListsPerHash longest, IDawgStateWriter writer)
{
while (pending. Count > 0)
{
var current = pending. Dequeue();

            writer.MoveToNode(current.NodeIndex);
            writer.IsLastSibling = current.IsLastSibling;
            writer.SymbolId = current.SymbolId;
            writer.IsEndOfWord = current.IsTerminal;

            if (current.IsTerminal)
            {
                var test = pending.ToString();
            }`

Any suggestions or help appreciated. I'm going back to reread. Thanks again.! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant