- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中edu.illinois.cs.cogcomp.lbjava.nlp.Word
类的一些代码示例,展示了Word
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word
类的具体详情如下:
包路径:edu.illinois.cs.cogcomp.lbjava.nlp.Word
类名称:Word
[英]Implementation of a word for natural language processing. Please note that in general, one can only count on the form
and capitalized
fields described below having meaningful values. The form
field can be assumed to be filled in because it's hard to imagine a situation in which a Word
object should be created without any knowledge of how that word appeared in text. The capitalized
field is computed from the form
by this class' constructor.
All other fields must be obtained or computed externally. Space is provided for them in this class' implementation as a convenience, since we expect the user will make frequent use of these fields.
This class extends from edu.illinois.cs.cogcomp.lbjava.parse.LinkedChild. Of course, this means that objects of this class contain references to both the previous and the next word in the sentence. Constructors are available that take the previous word as an argument, setting that reference. Thus, a useful technique for constructing all the words in a sentence will involve code that looks like this (where form
is a String):
Word current = new Word(form); a loop of some sort { current.next = new Word(form, current); current = current.next; }
[中]自然语言处理的一个单词的实现。请注意,一般情况下,只能指望下面描述的form
和capitalized
字段具有有意义的值。form
字段可以假定为已填充,因为很难想象在不知道该单词在文本中的显示方式的情况下创建Word
对象。capitalized
字段由此类的构造函数根据form
计算得出。
所有其他字段必须从外部获取或计算。为了方便起见,在这个类的实现中为它们提供了空间,因为我们希望用户经常使用这些字段。
这门课是从edu扩展而来的。伊利诺伊州反恐精英。cogcomp。lbjava。作语法分析LinkedChild。当然,这意味着这个类的对象包含对句子中上一个单词和下一个单词的引用。可以使用构造函数将前一个单词作为参数,设置引用。因此,构建句子中所有单词的有用技术将涉及如下代码(其中form
是一个字符串):Word current = new Word(form); a loop of some sort { current.next = new Word(form, current); current = current.next; }
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Add the provided token to the sentence, for also do any additional word spliting.
*
* @param sentence the sentence to add the word to.
* @param token the individual token.
* @param tag the tag to annotate the word with.
*/
public static void addTokenToSentence(LinkedVector sentence, String token, String tag, ParametersForLbjCode prs) {
NEWord word = new NEWord(new Word(token), null, tag);
word.params = prs;
addTokenToSentence(sentence, word);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-ner
/**
* Add the provided token to the sentence, for also do any additional word spliting.
*
* @param sentence the sentence to add the word to.
* @param token the individual token.
* @param tag the tag to annotate the word with.
*/
public static void addTokenToSentence(LinkedVector sentence, String token, String tag, ParametersForLbjCode prs) {
NEWord word = new NEWord(new Word(token), null, tag);
word.params = prs;
addTokenToSentence(sentence, word);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-mlner
/**
* Add the provided token to the sentence, for also do any additional word spliting.
*
* @param sentence the sentence to add the word to.
* @param token the individual token.
* @param tag the tag to annotate the word with.
*/
public static void addTokenToSentence(LinkedVector sentence, String token, String tag) {
NEWord word = new NEWord(new Word(token), null, tag);
addTokenToSentence(sentence, word);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-standalone-nlp-pipeline
public IllinoisPOSHandler()
{
super("Illinois Part-Of-Speech Tagger", "0.2", "illinoispos");
logger.info("Loading POS model..");
tagger.discreteValue(new Token(new Word("The"), null, ""));
logger.info("POS Tagger ready");
tokensfield = CuratorViewNames.tokens;
sentencesfield = CuratorViewNames.sentences;
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Given textual input in the format shown below, this method parses and
* returns the <code>Word</code> that the text represents. Expected
* format: <br><br>
* <p/>
* <code>(pos spelling)</code>
*
* @param text Text representing a word in POS bracket form.
* @param previous The word that came before this word in the sentence.
* @return A <code>Word</code> represented by the input text or
* <code>null</code> if the input does not represent a
* <code>Word</code>.
**/
public static Word parsePOSBracketForm(String text, Word previous) {
if (text.charAt(0) != '(' || text.charAt(text.length() - 1) != ')')
return null;
String[] tokens = text.split(" ");
if (tokens.length != 2) return null;
return new Word(tokens[1].substring(0, tokens[1].length() - 1),
tokens[0].substring(1),
previous);
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Given an array of <code>String</code>s, this method creates a new
* {@link LinkedVector} containing {@link Word}s.
*
* @param a An array of <code>String</code>s.
* @return A {@link LinkedVector} of {@link Word}s corresponding to the
* input <code>String</code>s.
**/
public static LinkedVector convert(String[] a) {
if (a == null) return null;
if (a.length == 0) return new LinkedVector();
Word w = new Word(a[0]);
for (int i = 1; i < a.length; ++i) {
w.next = new Word(a[i], null, w);
w = (Word) w.next;
}
return new LinkedVector(w);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava-NLP-tools
/**
* Given an array of <code>String</code>s, this method creates a new
* {@link LinkedVector} containing {@link Word}s.
*
* @param a An array of <code>String</code>s.
* @return A {@link LinkedVector} of {@link Word}s corresponding to the
* input <code>String</code>s.
**/
public static LinkedVector convert(String[] a) {
if (a == null) return null;
if (a.length == 0) return new LinkedVector();
Word w = new Word(a[0]);
for (int i = 1; i < a.length; ++i) {
w.next = new Word(a[i], null, w);
w = (Word) w.next;
}
return new LinkedVector(w);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava-NLP-tools
/**
* Given textual input in the format shown below, this method parses and
* returns the <code>Word</code> that the text represents. Expected
* format: <br><br>
* <p/>
* <code>(pos spelling)</code>
*
* @param text Text representing a word in POS bracket form.
* @param previous The word that came before this word in the sentence.
* @return A <code>Word</code> represented by the input text or
* <code>null</code> if the input does not represent a
* <code>Word</code>.
**/
public static Word parsePOSBracketForm(String text, Word previous) {
if (text.charAt(0) != '(' || text.charAt(text.length() - 1) != ')')
return null;
String[] tokens = text.split(" ");
if (tokens.length != 2) return null;
return new Word(tokens[1].substring(0, tokens[1].length() - 1),
tokens[0].substring(1),
previous);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-standalone-nlp-pipeline
public IllinoisChunkerHandler(String configFilename) {
super("Illinois Chunker", "0.3", "illinoischunker");
logger.info("Loading Chunker model..");
tagger.discreteValue(new Token(new Word("The"), null, ""));
logger.info("Chunker ready");
// XXX If no configuration file is give use the default values from CuratorViewNames
if (configFilename.trim().equals("")) {
tokensfield = CuratorViewNames.tokens;
sentencesfield = CuratorViewNames.sentences;
posfield = CuratorViewNames.pos;
}
else {
Properties config = new Properties();
try {
FileInputStream in = new FileInputStream(configFilename);
config.load(new BufferedInputStream(in));
in.close();
} catch (IOException e) {
logger.warn("Error reading configuration file. {}", configFilename);
}
tokensfield = config.getProperty("tokens.field", CuratorViewNames.tokens );
sentencesfield = config.getProperty("sentences.field", CuratorViewNames.sentences );
posfield = config.getProperty("pos.field", CuratorViewNames.pos );
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava-NLP-tools
Word w = new Word(tokens[1].substring(0, tokens[1].length() - 1),
tokens[0].substring(1),
0,
new Word(tokens[i + 1].substring(0, tokens[i + 1].length() - 1),
tokens[i].substring(1),
w,
代码示例来源:origin: CogComp/cogcomp-nlp
Word w = new Word(tokens[1].substring(0, tokens[1].length() - 1),
tokens[0].substring(1),
0,
new Word(tokens[i + 1].substring(0, tokens[i + 1].length() - 1),
tokens[i].substring(1),
w,
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Produces the next object parsed from the input file; in this case, that object is guaranteed
* to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence.
**/
public Object next() {
String[] line = (String[]) super.next();
while (line != null && (line.length < 2 || line[4].equals("-X-")))
line = (String[]) super.next();
if (line == null)
return null;
if (line[3].charAt(0) == 'I')
line[3] = "B" + line[3].substring(1);
Token t = new Token(new Word(line[5], line[4]), null, line[3]);
String previous = line[3];
for (line = (String[]) super.next(); line != null && line.length > 0; line =
(String[]) super.next()) {
if (line[3].charAt(0) == 'I' && !previous.endsWith(line[3].substring(2)))
line[3] = "B" + line[3].substring(1);
t.next = new Token(new Word(line[5], line[4]), t, line[3]);
t = (Token) t.next;
previous = line[3];
}
return new LinkedVector(t);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-chunker
/**
* Produces the next object parsed from the input file; in this case, that object is guaranteed
* to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence.
**/
public Object next() {
String[] line = (String[]) super.next();
while (line != null && (line.length < 2 || line[4].equals("-X-")))
line = (String[]) super.next();
if (line == null)
return null;
if (line[3].charAt(0) == 'I')
line[3] = "B" + line[3].substring(1);
Token t = new Token(new Word(line[5], line[4]), null, line[3]);
String previous = line[3];
for (line = (String[]) super.next(); line != null && line.length > 0; line =
(String[]) super.next()) {
if (line[3].charAt(0) == 'I' && !previous.endsWith(line[3].substring(2)))
line[3] = "B" + line[3].substring(1);
t.next = new Token(new Word(line[5], line[4]), t, line[3]);
t = (Token) t.next;
previous = line[3];
}
return new LinkedVector(t);
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Produces the next object parsed from the input file; in this case, that object is guaranteed
* to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence.
**/
public Object next() {
String[] line = (String[]) super.next();
while (line != null && line.length == 0)
line = (String[]) super.next();
if (line == null)
return null;
String pos = line[1];
if (pos.equals("-"))
pos = null;
Token t = new Token(new Word(line[0], pos), null, line[2]);
for (line = (String[]) super.next(); line != null && line.length > 0; line =
(String[]) super.next()) {
pos = line[1];
if (pos.equals("-"))
pos = null;
t.next = new Token(new Word(line[0], pos), t, line[2]);
t = (Token) t.next;
}
return new LinkedVector(t);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-chunker
/**
* Produces the next object parsed from the input file; in this case, that object is guaranteed
* to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence.
**/
public Object next() {
String[] line = (String[]) super.next();
while (line != null && line.length == 0)
line = (String[]) super.next();
if (line == null)
return null;
String pos = line[1];
if (pos.equals("-"))
pos = null;
Token t = new Token(new Word(line[0], pos), null, line[2]);
for (line = (String[]) super.next(); line != null && line.length > 0; line =
(String[]) super.next()) {
pos = line[1];
if (pos.equals("-"))
pos = null;
t.next = new Token(new Word(line[0], pos), t, line[2]);
t = (Token) t.next;
}
return new LinkedVector(t);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-mlner
private static Vector<NEWord> splitWord(NEWord word) {
String[] sentence = {word.form + " "};
Parser parser = new WordSplitter(new SentenceSplitter(sentence));
LinkedVector words = (LinkedVector) parser.next();
Vector<NEWord> res = new Vector<>();
if (words == null) {
res.add(word);
return res;
}
String label = word.neLabel;
for (int i = 0; i < words.size(); i++) {
if (label.contains("B-") && i > 0)
label = "I-" + label.substring(2);
NEWord w = new NEWord(new Word(((Word) words.get(i)).form), null, label);
res.addElement(w);
}
return res;
}
代码示例来源:origin: CogComp/cogcomp-nlp
private static Vector<NEWord> splitWord(NEWord word) {
String[] sentence = {word.form + " "};
Parser parser = new WordSplitter(new SentenceSplitter(sentence));
LinkedVector words = (LinkedVector) parser.next();
Vector<NEWord> res = new Vector<>();
if (words == null) {
res.add(word);
return res;
}
String label = word.neLabel;
for (int i = 0; i < words.size(); i++) {
if (label.contains("B-") && i > 0)
label = "I-" + label.substring(2);
NEWord w = new NEWord(new Word(((Word) words.get(i)).form), null, label);
res.addElement(w);
}
return res;
}
代码示例来源:origin: CogComp/cogcomp-nlp
Token t = first = new Token(new Word(s[0]), null, null);
t.next = new Token(new Word(s[i]), t, null);
t = (Token) t.next;
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-ner
private static Vector<NEWord> splitWord(NEWord word) {
String[] sentence = {word.form + " "};
Parser parser = new WordSplitter(new SentenceSplitter(sentence));
LinkedVector words = (LinkedVector) parser.next();
Vector<NEWord> res = new Vector<>();
if (words == null) {
res.add(word);
return res;
}
String label = word.neLabel;
for (int i = 0; i < words.size(); i++) {
if (label.contains("B-") && i > 0)
label = "I-" + label.substring(2);
NEWord w = new NEWord(new Word(((Word) words.get(i)).form), null, label);
res.addElement(w);
}
return res;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-pos
Token t = first = new Token(new Word(s[0]), null, null);
t.next = new Token(new Word(s[i]), t, null);
t = (Token) t.next;
我尝试进行词形还原,即识别动词的词形和可能的阿拉伯语词根,例如: يتصل ==> lemma(动词的不定式)==> اتصل ==> root(三字根/Jidr thoulathi) ==> و ص
在执行 NLP 或 IR/IE 相关任务时,是否有人们通常用来删除标点符号和关闭类别词(例如 he, she, it)的停用词列表? 我一直在尝试使用 gibbs 抽样来进行词义消歧的主题建模,并且它
我不知道StackOverflow是否涵盖NLP,所以我来试试。 我有兴趣从特定 Realm 中找到两个词的语义相关性,即“图像质量”和“噪声”。我正在做一些研究,以确定相机的评论对于相机的特定属性是
是否有算法或方法可以评估文本项之间的共同趋势/主题? 例如,假设有四个数据点(文本条目): “我发现学校今天压力很大” “物理测试非常容易。” “我的物理测试根本没有挑战” “每个人都提早离开了,因为
我有兴趣了解有关 Natural Language Processing 的更多信息(NLP)并且我很好奇目前是否有任何不基于字典识别的策略来识别文本中的专有名词?另外,任何人都可以解释或链接到解释当
特征用于模型训练和测试。自然语言处理中的词汇特征和正字法特征有什么区别?例子首选。 最佳答案 我不知道这样的区别,大多数时候当人们谈论词汇特征时,他们谈论的是使用这个词本身,而不是仅使用其他特征,即它
在 NLP 任务中,人们用 SOC(句子开头)和 EOC(句子结尾)注释句子是很常见的。他们为什么这样做? 这是一个任务相关的表现吗?例如,您在 NER 问题中进行填充的原因与您在翻译问题中进行填充的
我一直在研究 NLP 并使用 notepad++ 来处理文本文件。这很好,在某些情况下,但问题是无法使用包含大量文本的大型文件进行锻炼。 VIM 不支持 UTF-8。哪一个是最好的支持 unicode
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 3年前关闭。 Improve this questi
我在 Stanford CoreNLP demo page 中解析了以下句子和 Stanford parser demo page .尽管两者都会导致可以暗示目的语义的解析(相应地取决于 advcl
语义网和自然语言处理之间究竟有什么区别? 语义网是自然语言处理的一部分吗? 最佳答案 这是两个独立的学科领域,但它们在某些地方确实重叠。因为文档,无论其格式如何,都是由异构语法和语义组成的,所以目标是
我需要解析非结构化文本并将相关概念转换为格式,以便所有三元组可以合并形成一个图。例如如果我有 2 个句子,比如 A improves B 和 B improves C,我应该能够创建一个像这样的图 A
使用 GATE 时,本体在自然语言处理中的作用是什么? 据我了解,在较高层次上,本体允许对由类、它们的实例、这些实例的属性以及域中类之间的关系组成的域进行建模。 但是,在使用 GATE 时创建自定义本
我最后一年的工程项目要求我使用 Java 或 Python 构建一个应用程序,该应用程序使用自然语言处理来总结文本文档。我什至如何开始编写这样的应用程序? 根据一些研究,我刚刚注意到基于提取的摘要对我
我想知道是否可以使用 Stanford CoreNLP检测一个句子是用哪种语言写的?如果是这样,这些算法的精确度如何? 最佳答案 几乎可以肯定,此时斯坦福 COreNLP 中没有语言识别。 “几乎”
我在一家制造可以与 child 交谈的玩具车的公司工作。我们想使用斯坦福核心 NLP 作为解析器。但是,它以 GPL 许可:他们不允许在商业上使用 NLP。我可以从斯坦福 NLP 小组购买其他许可证吗
我想使用 Natural Language Processing Libraries 从句子中找到谓词和主语.这种技术在NLP的世界里有什么名字吗?或者有没有办法做到这一点? Example : He
所以,这个问题可能有点幼稚,但我认为询问 Stackoverflow 的友好人士不会有什么坏处。 我现在的公司已经使用第三方 API 进行 NLP 一段时间了。我们基本上对一个字符串进行 URL 编码
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 3年前关闭。 Improve thi
这可能是一个愚蠢的问题,但是如何迭代解析树作为 NLP 解析器(如斯坦福 NLP)的输出?它都是嵌套的括号,既不是 array 也不是 dictionary 或我使用过的任何其他集合类型。 (ROOT
我是一名优秀的程序员,十分优秀!