本文整理了Java中net.sf.extjwnl.data.Word.getPOS()
方法的一些代码示例,展示了Word.getPOS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word.getPOS()
方法的具体详情如下:
包路径:net.sf.extjwnl.data.Word
类名称:Word
方法名:getPOS
[英]Returns the part of speech of this word.
[中]返回该单词的词性。
代码示例来源:origin: net.sf.extjwnl/extjwnl
/**
* Returns sense number of this word (1-based) or 0 if not found.
* sense_number is a decimal integer indicating the sense number of the word,
* within the part of speech encoded in sense_key, in the WordNet database.
*
* @return sense number or 0 if not found
* @throws JWNLException JWNLException
*/
public int getSenseNumber() throws JWNLException {
int result = 0;
if (null != dictionary) {
IndexWord indexWord = dictionary.getIndexWord(getPOS(), lemma);
if (null != indexWord) {
result = indexWord.getSenses().indexOf(synset) + 1;
}
}
return result;
}
代码示例来源:origin: extjwnl/extjwnl
/**
* Returns sense number of this word (1-based) or 0 if not found.
* sense_number is a decimal integer indicating the sense number of the word,
* within the part of speech encoded in sense_key, in the WordNet database.
*
* @return sense number or 0 if not found
* @throws JWNLException JWNLException
*/
public int getSenseNumber() throws JWNLException {
int result = 0;
if (null != dictionary) {
IndexWord indexWord = dictionary.getIndexWord(getPOS(), lemma);
if (null != indexWord) {
result = indexWord.getSenses().indexOf(synset) + 1;
}
}
return result;
}
代码示例来源:origin: apache/opennlp-sandbox
public void setSynonyms() {
for (Word word : synset.getWords())
synonyms.add(new WordPOS(word.toString(), word.getPOS()));
}
代码示例来源:origin: extjwnl/extjwnl
private void addToIndexWords(Word word) {
if (null != dictionary && dictionary.isEditable()) {
try {
IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma());
if (null == iw) {
dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this);
} else {
if (!iw.getSenses().contains(Synset.this)) {
iw.getSenses().add(Synset.this);
}
}
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
}
}
}
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
private void addToIndexWords(Word word) {
if (null != dictionary && dictionary.isEditable()) {
try {
IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma());
if (null == iw) {
dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this);
} else {
if (!iw.getSenses().contains(Synset.this)) {
iw.getSenses().add(Synset.this);
}
}
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
}
}
}
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
/**
* Ctor that takes a synset and a word. It verifies that the word indeed belongs to the synset.
* <p>
* <b>NOTE</b> ExtJwnl <i>lowercases</i> the words it is queried about. But the words it retrieves in methods like <code>realSynset.getWords()</code>
* are case sensitive!
*
* @param synset
* @param strWord
* @throws WordNetException
*/
public ExtJwnlSensedWord(ExtJwnlSynset synset, String strWord) throws WordNetException {
this.synset = synset;
this.word = strWord;
String wordToLookup = strWord.replace(' ', '_'); // mimic jwnl, which replaces underscores with spaces when looking up
List<Word> words = synset.realSynset.getWords();
Word wordObj = lookupWordInWords(words, wordToLookup);
if (wordObj == null)
throw new WordNetException("\""+ strWord + "\" is not a memeber of the given synset " + synset);
this.wordObj = wordObj;
dictionary = synset.extJwnlDictionary;
this.pos = ExtJwnlUtils.getWordNetPartOfSpeech( wordObj.getPOS());
}
代码示例来源:origin: extjwnl/extjwnl
public String toString() {
return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()});
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
public String toString() {
return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()});
}
代码示例来源:origin: net.sf.extjwnl/extjwnl-utilities
private static int getSenseNo(final Word word) throws JWNLException {
final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma());
for (int i = 0; i < iw.getSenses().size(); i++) {
if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) {
return i;
}
}
return -1;
}
代码示例来源:origin: extjwnl/extjwnl
private static int getSenseNo(final Word word) throws JWNLException {
final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma());
for (int i = 0; i < iw.getSenses().size(); i++) {
if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) {
return i;
}
}
return -1;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
protected int getSynsetType() {
int ss_type = getPOS().getId();
if (POS.ADJECTIVE == getSynset().getPOS() && getSynset().isAdjectiveCluster()) {
ss_type = POS.ADJECTIVE_SATELLITE_ID;
}
return ss_type;
}
代码示例来源:origin: extjwnl/extjwnl
protected int getSynsetType() {
int ss_type = getPOS().getId();
if (POS.ADJECTIVE == getSynset().getPOS() && getSynset().isAdjectiveCluster()) {
ss_type = POS.ADJECTIVE_SATELLITE_ID;
}
return ss_type;
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
/**
* Ctor with an {@link Word} and a dictionary
* This Ctor is quicker than the other.
* @param jwiDictionary
* @throws WordNetException
*/
ExtJwnlSensedWord(Word wordObj, ExtJwnlDictionary extJwnlDictionary) throws WordNetException {
if (wordObj==null)
throw new WordNetException("wordObj is null!");
this.wordObj = wordObj;
this.synset = new ExtJwnlSynset(extJwnlDictionary, wordObj.getSynset());
this.word = wordObj.getLemma();
this.dictionary = extJwnlDictionary;
this.pos = ExtJwnlUtils.getWordNetPartOfSpeech( wordObj.getPOS());
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.si.wordnet
public CachedSense(String senseId)
throws SenseInventoryException
{
super(senseId);
try {
word = wn.getWordBySenseKey(senseId);
synset = word.getSynset();
pos = wordNetPosToSiPos.transform(word.getPOS());
useCount = word.getUseCount();
}
catch (JWNLException e) {
throw new SenseInventoryException(e);
}
}
代码示例来源:origin: de.tudarmstadt.ukp.uby/de.tudarmstadt.ukp.uby.integration.wordnet-gpl
if(!posSet){
lexicalEntry.setPartOfSpeech(WNConvUtil.getPOS(lexeme.getPOS()));
posSet = true;
内容来源于网络,如有侵权,请联系作者删除!