コード例 #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>();
 }