private TrajectoryVocabulary(Serialization serialization) { this.vectorsAlphabet = serialization.Alphabet; this.levenshteinAlphabet = CreateLevenshteinAlphabet(this.vectorsAlphabet); this.knownStrings = new Dictionary <string, VocabularyItem>(); foreach (var knownGlyph in serialization.KnownTrajectories) { var strings = new List <TrajectoryDescriptor>(); foreach (var desc in knownGlyph.Descriptors) { var jaggedArray = desc.Strings.Select(ints => ints.Ints.ToList()).ToList(); strings.Add(new TrajectoryDescriptor(jaggedArray, this.levenshteinAlphabet)); } this.knownStrings.Add(knownGlyph.Name, new VocabularyItem(strings)); } }
public TrajectoryDescriptor(Trajectory trajectory, Vector3[] tokens, Levenshtein.Alphabet <int> alphabet) : this(GetTrajectoryDescriptor(trajectory, tokens, FINEST_LEVEL_DESCRIPTOR_RESOLUTION), alphabet) { }
public TrajectoryDescriptor(List <List <int> > descriptor, Levenshtein.Alphabet <int> alphabet) { this.Strings = descriptor.Select(ints => new Levenshtein.String <int>(ints.ToArray(), alphabet)).ToList(); }
private TrajectoryVocabulary() { this.vectorsAlphabet = Utils.GenerateAlphabet(fixedValues: Vector3.forward); this.levenshteinAlphabet = CreateLevenshteinAlphabet(this.vectorsAlphabet); this.knownStrings = new Dictionary <string, VocabularyItem>(); }