public LexicalIDM(LexicalSentenceProcessor sentPoc) throws UnsupportedPosTagStringException { m_nounPOS = new ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); m_lexicalSentenceProcessor = sentPoc; }
public ParenthesesExtractor(Lemmatizer lemmatizer) { m_lemmatizer=lemmatizer; m_logger = org.apache.log4j.Logger.getLogger(ParenthesesExtractor.class.getName()); try { m_lemmatizer.init(); m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { m_logger.warn("should never happend because we only create CanonicalPosTag.NOUN . Exception:",e); } catch (LemmatizerException e) { m_logger.fatal("failed to initialize lemmatizer in ParenthesesExtractor",e); } }
public SyntacticIDM(SyntacticUtils utils) throws UnsupportedPosTagStringException, ParserRunException{ super(); m_logger = org.apache.log4j.Logger.getLogger(SyntacticIDM.class.getName()); m_treeParser = utils.getParserInstance(); m_utils = utils; m_nounPOS = new ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); }
public RedirectExtractor(Lemmatizer lemmatizer) { m_lemmatizer=lemmatizer; m_logger = org.apache.log4j.Logger.getLogger(RedirectExtractor.class.getName()); try { m_lemmatizer.init(); m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { m_logger.warn("should never happend because we only create CanonicalPosTag.NOUN . Exception:",e); } catch (LemmatizerException e) { m_logger.fatal("failed to initialize lemmatizer in RedirectExtractor",e); } } @Override
public CategoryExtractor(Lemmatizer lemmatizer) { m_lemmatizer=lemmatizer; m_logger = org.apache.log4j.Logger.getLogger(CategoryExtractor.class.getName()); try { m_lemmatizer.init(); m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { e.printStackTrace(); } catch (LemmatizerException e) { m_logger.fatal("failed to initialize lemmatizer in CategoryExtractor",e); } }
public void set(String word) throws LemmatizerException { this.word = word; try { this.partOfSpeech = new ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); } catch(Exception e) { throw new LemmatizerException("POS exception", e); } }
public WikipediaLexicalResource(Classifier classifier, int limitOnRetrievedRules, String driver, String url, String username, String password ) throws UnsupportedPosTagStringException { this.m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); this.m_classifier = classifier; this.m_limitOnRetrievedRules = limitOnRetrievedRules; this.m_retrivalTool = new RetrievalTool(driver, url, username, password); }
public LinksExtractor(Lemmatizer lemmatizer) { m_lemmatizer=lemmatizer; m_logger = org.apache.log4j.Logger.getLogger(LinksExtractor.class.getName()); try { m_lemmatizer.init(); m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (LemmatizerException e) { m_logger.fatal("failed to initialize lemmatizer in LinksExtractor",e); } } @Override
public RedisBasedWikipediaLexicalResource(Classifier classifier, int limitOnRetrievedRules, String leftRedisDBFile, String rightRedisDBFile, boolean bVM) throws UnsupportedPosTagStringException, FileNotFoundException, RedisRunException { leftRules = new RedisBasedStringListBasicMap(leftRedisDBFile, bVM); rightRules = new RedisBasedStringListBasicMap(rightRedisDBFile, bVM); this.m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); this.m_classifier = classifier; this.m_limitOnRetrievedRules = limitOnRetrievedRules; }
public RedisBasedWikipediaLexicalResource(Classifier classifier, int limitOnRetrievedRules, String leftRedisHost, int leftRedisPort, String rightRedisHost, int rightRedisPort) throws UnsupportedPosTagStringException { leftRules = new RedisBasedStringListBasicMap(leftRedisHost,leftRedisPort); rightRules = new RedisBasedStringListBasicMap(rightRedisHost,rightRedisPort); this.m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); this.m_classifier = classifier; this.m_limitOnRetrievedRules = limitOnRetrievedRules; }
public void setUnspecifiedPosTag(PartOfSpeech unspecifiedPosTag) throws UnsupportedPosTagStringException{ this.unspecifiedPosTag = new ByCanonicalPartOfSpeech(unspecifiedPosTag.getCanonicalPosTag().toString()); this.setPosTag(unspecifiedPosTag); }
public WikipediaLexicalResource(ConfigurationParams params) throws ConfigurationException, LexicalResourceException { this.m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { throw new LexicalResourceException(e.toString());
public LexicalIDM(Tokenizer tokenizer, PosTagger postagger, Lemmatizer lemmatizer) throws InstrumentCombinationException, TokenizerException, PosTaggerException, LemmatizerException, UnsupportedPosTagStringException { m_tokenizer = tokenizer; m_tokenizer.init(); // we must call init before using the tokenizer m_postagger = postagger; m_postagger.init();// we must call init before using the tagger (process function) m_lemmatizer = lemmatizer; m_lemmatizer.init();//we must call it? m_nounPOS = new ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); m_lexicalSentenceProcessor=new LexicalSentenceProcessor(tokenizer, postagger, lemmatizer, null); }
PartOfSpeech testPOS = new ByCanonicalPartOfSpeech(CanonicalPosTag.NN.name());
public static void main(String args[]) throws LexicalResourceException, UnsupportedPosTagStringException { Direct1000LexicalResource resource = new Direct1000LexicalResource("jdbc:mysql://localhost:3306/bap","root","root",10); List<? extends LexicalRule<? extends RuleInfo>> similarities = resource.getRulesForLeft("find",new ByCanonicalPartOfSpeech(CanonicalPosTag.V.name())); for (LexicalRule<? extends RuleInfo> similarity : similarities) System.out.println("<" + similarity.getLLemma() + "," + similarity.getLPos() + ">" + " --> " + "<" + similarity.getRLemma() + "," + similarity.getRPos() + ">" + ": " + similarity.getConfidence()); } }
WiktionaryPartOfSpeech wktPos = WiktionaryPartOfSpeech.toWiktionaryPartOfspeech(new ByCanonicalPartOfSpeech( CanonicalPosTag.N.name())); List<WiktionarySense> senses = wiktionary.getSortedSensesOf(lemma, wktPos);
m_lemmatizer.set(title,new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name())); m_lemmatizer.process(); title = m_lemmatizer.getLemma(); category=UtilClass.getInstance().deAccent(category); category = category.toLowerCase(); m_lemmatizer.set(category,new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(eu.excitementproject.eop.common.representation.partofspeech.CanonicalPosTag.N.name())); m_lemmatizer.process(); category=m_lemmatizer.getLemma();
public RedisBasedWikipediaLexicalResource(ConfigurationParams params) throws ConfigurationException, LexicalResourceException, RedisRunException { this.m_nounPOS = new eu.excitementproject.eop.common.representation.partofspeech.ByCanonicalPartOfSpeech(CanonicalPosTag.N.name()); } catch (UnsupportedPosTagStringException e) { throw new LexicalResourceException(e.toString());
LexicalRule<RuleInfo> rule = new LexicalRule<RuleInfo>( left.getData().getLemma(), new ByCanonicalPartOfSpeech(left.getData().getPOS().name()), right.getData().getLemma(), new ByCanonicalPartOfSpeech(right.getData().getPOS().name()), elemenstSimilarityMeasure.getSimilarityMeasure(), null, similarityStorage.getComponentName(), DistSimRuleInfo.getInstance());
@Override public List<LexicalRule<? extends RuleInfo>> getRules(String leftLemma, PartOfSpeech leftPos, String rightLemma, PartOfSpeech rightPos) throws LexicalResourceException { try { List<LexicalRule<? extends RuleInfo>> ret = new LinkedList<LexicalRule<? extends RuleInfo>>(); LemmaPosBasedElement leftElement = new LemmaPosBasedElement(new LemmaPos(leftLemma, (leftPos == null ? null : leftPos.getCanonicalPosTag()))); LemmaPosBasedElement rightElement = new LemmaPosBasedElement(new LemmaPos(rightLemma, (rightPos == null ? null : rightPos.getCanonicalPosTag()))); for (ElementsSimilarityMeasure similarityRule : similarityStorage.getSimilarityMeasure(leftElement, rightElement)) { LemmaPosBasedElement left = (LemmaPosBasedElement)similarityRule.getLeftElement(); LemmaPosBasedElement right = (LemmaPosBasedElement)similarityRule.getRightElement(); ret.add(new LexicalRule<RuleInfo>(left.getData().getLemma(), new ByCanonicalPartOfSpeech(left.getData().getPOS().name()), right.getData().getLemma(), new ByCanonicalPartOfSpeech(right.getData().getPOS().name()), similarityRule.getSimilarityMeasure(), null, similarityStorage.getComponentName(), DistSimRuleInfo.getInstance())); } return ret; } catch (Exception e) { throw new LexicalResourceException(ExceptionUtil.getStackTrace(e)); } }