/** * @param string * @return * @throws JwktlException */ private List<PosTaggedToken> posTag(String string) throws JwktlException { try { // must pos tag the term even though wiki already has, cos the wiki POS don't tell us if the // noun is singular posTagger.setTokenizedSentence(string.trim()); posTagger.process(); return posTagger.getPosTaggedTokens(); } catch (PosTaggerException e) { throw new JwktlException("POS tagger error", e); } }
/** * Ctor * * @param posTaggerModelFile e.g. * "b:/jars/stanford-postagger-2008-09-28/bidirectional-wsj-0-18.tagger" * @throws JwktlException */ public WktGlossParser(String posTaggerModelFile) throws JwktlException { try { parser = new EasyFirstParser(posTaggerModelFile); parser.init(); } catch (ParserRunException e) { throw new JwktlException("could not init the parser", e); } try { posTagger = new MaxentPosTagger(posTaggerModelFile); posTagger.init(); } catch (PosTaggerException e) { throw new JwktlException("POS tagger error", e); } }