1

我是 Mallet 的新手,并试图使用它的 CRF 功能来进行命名实体识别。我知道有一个例子展示了如何在他们的网站上使用 Java 导入数据,但它处理的是纯文本(不是训练集格式)。现在我有以下格式的训练数据(网站上显示的确切格式)。第一列是单词,第二列是标签。

a   O
50  AGE
year    AGE
old O
man GENDER
with    O
a   O
history O
of  O
suicide O
attempt O
experienced O
an  O
epileptic   O
seizure O
on  O
22-dec-01   DATE
.   O 
----

注意:它在渲染输出中不可见,但这似乎是制表符分隔的

所以现在我被卡住了。我应该如何使用 Mallet API 将上述数据导入为训练集?

我知道如何在命令行中执行此操作,但我想编写 JAVA 代码,以便将来可以使用他们的 API 添加更多功能。

4

1 回答 1

0

您可以在 mallet 中使用 FileIterator 或 CSVIterator 或 ArrayIterator 读取训练实例。您可以在http://mallet.cs.umass.edu/classifier-devel.php找到 CSVIteartor 的用法。FileIterator 和 ArrayIterator 的用法可在http://www.programcreek.com/java-api-examples/index.php?api=cc.mallet.pipe.iterator.FileIteratorhttp://www.programcreek.com/java -api-examples/index.php?api=cc.mallet.pipe.iterator.Arrayiterator分别。

您可以在http://www.programcreek.com/java-api-examples/index.php?api=cc.mallet.fst.CRF找到有关如何通过 mallet 中的 Java 代码使用 CRF 的信息

于 2016-09-18T13:54:01.017 回答