Exemplo n.º 1
0
		protected internal Relation(WordNetEngine wordNetEngine, RelationType relationType, int targetSynsetOffset, string targetSynsetPartOfSpeech)
		{
			mWordNetEngine = wordNetEngine;
			mRelationType = relationType;

			mTargetSynsetOffset = targetSynsetOffset;
			mTargetSynsetPartOfSpeech = targetSynsetPartOfSpeech;
		}
 public WordnetDictionary(string searchDirectory)
 {
     mEngine = new DataFileEngine(searchDirectory);
     Dictionary<string, string[][]> suffixMap = new Dictionary<string, string[][]>();
     suffixMap.Add("noun", new string[][] { new string[] { "s", "" }, new string[] { "ses", "s" }, new string[] { "xes", "x" }, new string[] { "zes", "z" }, new string[] { "ches", "ch" }, new string[] { "shes", "sh" }, new string[] { "men", "man" }, new string[] { "ies", "y" } });
     suffixMap.Add("verb", new string[][] { new string[] { "s", "" }, new string[] { "ies", "y" }, new string[] { "es", "e" }, new string[] { "es", "" }, new string[] { "ed", "e" }, new string[] { "ed", "" }, new string[] { "ing", "e" }, new string[] { "ing", "" } });
     suffixMap.Add("adjective", new string[][] { new string[] { "er", "" }, new string[] { "est", "" }, new string[] { "er", "e" }, new string[] { "est", "e" } });
     DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
     tokDso.AddDelegate(DetachSuffixesOperation.Operations, new IOperation[] { new LookupIndexWordOperation(mEngine), new LookupExceptionsOperation(mEngine) });
     TokenizerOperation tokOp = new TokenizerOperation(mEngine, new string[] { " ", "-" });
     tokOp.AddDelegate(TokenizerOperation.TokenOperations, new IOperation[] { new LookupIndexWordOperation(mEngine), new LookupExceptionsOperation(mEngine), tokDso });
     DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
     morphDso.AddDelegate(DetachSuffixesOperation.Operations, new IOperation[] { new LookupIndexWordOperation(mEngine), new LookupExceptionsOperation(mEngine) });
     mDefaultOperations = new IOperation[] { new LookupExceptionsOperation(mEngine), morphDso, tokOp };
 }
Exemplo n.º 3
0
		public JWNLDictionary(string searchDirectory)
		{
            //PointerType.initialize();
            //Adjective.initialize();
            //VerbFrame.initialize();
            ////UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
            //System.Collections.IDictionary suffixMap = new System.Collections.Hashtable();
            //suffixMap[POS.NOUN] = new string[][]{new string[]{"s", ""}, new string[]{"ses", "s"}, new string[]{"xes", "x"}, new string[]{"zes", "z"}, new string[]{"ches", "ch"}, new string[]{"shes", "sh"}, new string[]{"men", "man"}, new string[]{"ies", "y"}};
            //suffixMap[POS.VERB] = new string[][]{new string[]{"s", ""}, new string[]{"ies", "y"}, new string[]{"es", "e"}, new string[]{"es", ""}, new string[]{"ed", "e"}, new string[]{"ed", ""}, new string[]{"ing", "e"}, new string[]{"ing", ""}};
            //suffixMap[POS.ADJECTIVE] = new string[][]{new string[]{"er", ""}, new string[]{"est", ""}, new string[]{"er", "e"}, new string[]{"est", "e"}};
            //DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
            //tokDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[]{new LookupIndexWordOperation(), new LookupExceptionsOperation()});
            //TokenizerOperation tokOp = new TokenizerOperation(new string[]{" ", "-"});
            //tokOp.addDelegate(TokenizerOperation.TOKEN_OPERATIONS, new Operation[]{new LookupIndexWordOperation(), new LookupExceptionsOperation(), tokDso});
            //DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
            //morphDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[]{new LookupIndexWordOperation(), new LookupExceptionsOperation()});
            //Operation[] operations = new Operation[]{new LookupExceptionsOperation(), morphDso, tokOp};
            //morphy = new DefaultMorphologicalProcessor(operations);

            //FileManager manager = new FileManagerImpl(searchDirectory, typeof(PrincetonRandomAccessDictionaryFile));
            //FileDictionaryElementFactory factory = new PrincetonWN17FileDictionaryElementFactory();
            //FileBackedDictionary.install(manager, morphy, factory, true);
            //dict = net.didion.jwnl.dictionary.Dictionary.getInstance();
            //morphy = dict.getMorphologicalProcessor();

            mEngine = new DataFileEngine(searchDirectory);
            morphologicalProcess += mEngine.LookupExceptionsOperation;
            morphologicalProcess += mEngine.LookupIndexWordOperation;
		}
Exemplo n.º 4
0
		protected internal Relation(WordNetEngine wordNetEngine, RelationType relationType, int targetSynsetOffset, string targetSynsetPartOfSpeech, int sourceWord, int targetWord) : this(wordNetEngine, relationType, targetSynsetOffset, targetSynsetPartOfSpeech)
		{
			miSourceWord = sourceWord;
			miTargetWord = targetWord;
		}
Exemplo n.º 5
0
 protected internal Relation(WordNetEngine wordNetEngine, RelationType relationType, int targetSynsetOffset, string targetSynsetPartOfSpeech, int sourceWord, int targetWord) : this(wordNetEngine, relationType, targetSynsetOffset, targetSynsetPartOfSpeech)
 {
     miSourceWord = sourceWord;
     miTargetWord = targetWord;
 }