示例#1
0
        public void CreateWords(ILexemeStore store)
        {
            // For Uri's you can use anything.  I suggest using a terse form of Uri
            // like that used in Turtle/N3 (http://www.w3.org/TeamSubmission/turtle/)

            // Each word is define using a fluent builder interface that can build graphs of words
            string synsetForHello = dummyNamespace + "hello";

            store.Store(Lexeme.New.Noun(synsetForHello, "hello", typeof(Noun.hello)));

            string synsetForWorld = dummyNamespace + "world";

            store.Store(Lexeme.New.Noun(synsetForWorld, "world", typeof(Noun.world)));

            // Alternatives to building dictionaries this way include:
            //  1. Defining new Tokens with a parser method that can parse strings or perform lookups against a database or web service
            //  2. Reading text files or XML files to create a dictionary
            //  3. Using the provided Wordnet reader project which can load the whole of Wordnet into memory and can apply interfaces to Synsets

            string synsetForGoodbye = dummyNamespace + "goodbye";

            store.Store(Lexeme.New.Noun(synsetForGoodbye, "goodbye", typeof(Noun.goodbye)));
            store.Store(Lexeme.New.Noun(synsetForGoodbye, "bye", typeof(Noun.goodbye)));

            string synsetForMicrosoft = dummyNamespace + "Microsoft";

            store.Store(Lexeme.New.Noun(synsetForMicrosoft, "Microsoft", typeof(Microsoft)));
            store.Store(Lexeme.New.Noun(synsetForMicrosoft, "MSFT", typeof(Microsoft)));

            string synsetForGoogle = dummyNamespace + "Google";

            store.Store(Lexeme.New.Noun(synsetForGoogle, "Google", typeof(Google)));

            string synsetForFacebook = dummyNamespace + "Facebook";

            store.Store(Lexeme.New.Noun(synsetForFacebook, "Facebook", typeof(Facebook)));

            // If you never need to refer to a Lexeme specifically there's no need to define an interface for it
            // or to have a specific Synset name, one will be created for you

            store.Store(Lexeme.New.Noun("Nintendo", typeof(CompanyName)));

            // Included rules can do normal verb conjugations (single, plural, past, participle, ...) so often you only need to define one word
            // For each token you can attach any number of interfaces (though normally you only need one since it inherits all the others)
            // Verb.Type.Present in this case is not needed and Verb.Type.Transitive could have been specified in the interface definition instead

            store.Store(Lexeme.New.Verb("report", typeof(Verb.report), typeof(AboditNLP.Verb.Tense.Present), typeof(AboditNLP.Verb.Type.Transitive))
                        // If you need to override an irregular verb, or add an interface to a specific tense you can do that
                        .Past("reported", typeof(Verb.reported)));

            store.Store(Lexeme.New.Verb("debug", typeof(Verb.debug), typeof(AboditNLP.Verb.Tense.Present)));
        }
        public void CreateWords(ILexemeStore store)
        {
            // Pull all the words from MetaSynsets and define them separately in a dictionary
            store.Store(Lexeme.New.Noun("small_area-noun-1", "small area"));
            store.Store(Lexeme.New.Noun("large_area-noun-1", "large area"));
            store.Store(Lexeme.New.Noun("width-noun-1", "width"));
            store.Store(Lexeme.New.Noun("width-noun-1", "breadth"));

            store.Store(Lexeme.New.Adjective("small_area-adjective-1", "small in area")); // ??
            store.Store(Lexeme.New.Adjective("large_area-adjective-1", "large in area")); // ??

            store.Store(Lexeme.New.Adjective("expensive-adjective-1", "expensive"));
            store.Store(Lexeme.New.Adjective("cheap-adjective-1", "cheap"));

            store.Store(Lexeme.New.Noun("price-noun-2", "price"));
            store.Store(Lexeme.New.Verb("price-verb-1", "price"));

            store.Store(Lexeme.New.Adjective("close-adjective-1", "close", typeof(SmallType)));
            store.Store(Lexeme.New.Adjective("near-adjective-1", "near", typeof(SmallType)));
        }
示例#3
0
 public void CreateWords(ILexemeStore store)
 {
     store.AddMetaModel(new MockMetaModel());
 }