예제 #1
0
        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));
            }
        }
예제 #2
0
 public TrajectoryDescriptor(Trajectory trajectory, Vector3[] tokens, Levenshtein.Alphabet <int> alphabet)
     : this(GetTrajectoryDescriptor(trajectory, tokens, FINEST_LEVEL_DESCRIPTOR_RESOLUTION), alphabet)
 {
 }
예제 #3
0
 public TrajectoryDescriptor(List <List <int> > descriptor, Levenshtein.Alphabet <int> alphabet)
 {
     this.Strings = descriptor.Select(ints => new Levenshtein.String <int>(ints.ToArray(), alphabet)).ToList();
 }
예제 #4
0
 private TrajectoryVocabulary()
 {
     this.vectorsAlphabet     = Utils.GenerateAlphabet(fixedValues: Vector3.forward);
     this.levenshteinAlphabet = CreateLevenshteinAlphabet(this.vectorsAlphabet);
     this.knownStrings        = new Dictionary <string, VocabularyItem>();
 }