2014-10-01 77 views
0

我成功创建了一个情感分析管道,如下所示:https://gate.ac.uk/sale/talks/gate-course-may10/track-3/module-11-ml-adv/module-11-sentiment.pdf 但是现在我想用不同的语料库:它是德语;我有两个包含正面或负面特征的德语短语的文件。我把它写进一个.xml文件是这样的:GATE情绪分析如何工作?

<?xml version='1.0' encoding='UTF-8' ?> 
<GateDocument> 
<GateDocumentFeatures> 
<Feature> 
    <Name className="java.lang.String">gate.SourceURL</Name> 
    <Value className="java.lang.String">file:/C:/Users/user/Documents/text</Value> 
</Feature> 
<Feature> 
    <Name className="java.lang.String">MimeType</Name> 
    <Value className="java.lang.String">text/plain</Value> 
</Feature> 
</GateDocumentFeatures> 

<TextWithNodes> 
<Node id="0" />10:41 Uhr &apos; Ist aber ein schwacher Trost. 
<Node id="47" />1969 das Problem der Entsorgung offiziell angesprochen. 
<Node id="103" /> 
... 
</TextWithNodes> 

<AnnotationSet Name="Key"> 
<Annotation Id="0" Type="comment" StartNode="0" EndNode="47"> 
<Feature> 
    <Name className="java.lang.String">rating</Name> 
    <Value className="java.lang.Double">2.0</Value> 
</Feature> 
</Annotation> 
... 
</AnnotationSet> 
</GateDocument> 

但我不明白如何使用paum.xml:

1)在本例中,从本教程有一个字符串评级(例如“2_Star_Rating”)而不是Double,但我不知道paum.xml/pipeline是如何处理这个String-feature的 - 我怎么能告诉我的管道我现在有一个Double值可以使用?

2)当我在应用程序模式下运行批量学习PR时:文本语料库如何让人喜欢?纯文本是否正常?

在第一个试验中,我使用了教程中的同一个paum.xml文件,并将我的评分从double(2.0)转换为Strings(“2_Star_Rating”) - 并且在训练和应用模式中没有错误发生 - 但是当我查看在我的文本文件(我在app.mode中运行我的管道)中,没有设置注释。

+0

如果我使用String而不是double,只需将每个double转换为“pos”,“neg”或“neu”即可。所以问题(2)对我来说更重要。 – Munchkin 2014-10-01 10:42:14

回答

0

最后我发现了什么GATE期待: 给定的文件(须分析)必须是这样的:

<?xml version='1.0' encoding='UTF-8' ?> 
<GateDocument> 
<GateDocumentFeatures> 
<Feature> 
    <Name className="java.lang.String">gate.SourceURL</Name> 
    <Value className="java.lang.String">file:/C:/Users/user/Documents/text</Value> 
</Feature> 
<Feature> 
    <Name className="java.lang.String">MimeType</Name> 
    <Value className="java.lang.String">text/html</Value> 
</Feature> 
</GateDocumentFeatures> 
<TextWithNodes> 
<Node id="0" />sentence1 
<Node id="9" /> 
... 
</TextWithNodes> 

<AnnotationSet Name="Key"> 
<Annotation Id="1" Type="comment" StartNode="0" EndNode="9"> 
</Annotation> 
... 
</AnnotationSet> 
</GateDocument> 
+0

好吧,也可以(也更容易)使用纯文本并将JAPE传感器添加到向文本添加annotationSet的管道中(在这种情况下:将注释命名为“comment”并将outputASname设置为“Key”) – Munchkin 2014-10-01 14:20:19

1

为什么不使用一个简单的XML,如:

这与opinion1

这个注释1文本与opinion2

一个注释2文本它可以是一个注释每个文件或文件无线在一个文件中有很多评论。

然后,您可以使用AnnotationSet Transfer PR,并在语料库填充后将“原始标记”中的注释复制到默认设置。