使用 jwnl(Java WordNet 库)涉及 file_properties.xml
Using jwnl (Java WordNet Library) concerning file_properties.xml
需要更改 file_properties 以便工作并遵守演示文件 here
我已经改变了它。但是这个错误仍然存在。我对XML不是很熟悉。谁能帮忙修复解析文件时出现的错误。
这是 xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<jwnl_properties language="en"/></jwnl_properties>
<version publisher="Princeton" number="3.0" language="en"/>
<dictionary class="net.didion.jwnl.dictionary.FileBackedDictionary">
<param name="dictionary_path" value="C:\Program Files\WordNet- 3.0.1\dict\"/>
</dictionary>
<param name="morphological_processor" value="net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor">
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
<param value="net.didion.jwnl.dictionary.morph.TokenizerOperation">
<param name="delimiters">
<param value=" "/>
<param value="-"/>
</param>
<param name="token_operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
</param>
</param>
</param>
</param>
<param name="dictionary_element_factory" value="net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory"/>
<param name="file_manager" value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type" value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile"/>
<param name="dictionary_path" value="c:\program files\wordnet-3.0.0\dict"/>
</param>
</dictionary>
<resource class="PrincetonResource"/>
</jwnl_properties>
这是获取词义的简单代码 运行 时发生的错误。程序似乎没有错误。
[Fatal Error] :2:35: The markup in the document following the root element must be well-formed.
net.didion.jwnl.JWNLException: Error parsing the properties file
at net.didion.jwnl.JWNL.initialize(JWNL.java:117)
at Summarization.main(Summarization.java:46)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 35; The markup in the document following the root element must be well-formed.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at net.didion.jwnl.JWNL.initialize(JWNL.java:115)
... 1 more
好像在你的XML中<jwnl_properties>
标签被关闭了三次,第一次它被设置为空元素(末尾的/>
),然后就被关闭了再次使用 </jwnl_properties>
然后你在文件末尾得到另一个 </jwnl_properties>
。
如果将第二行从
<jwnl_properties language="en"/></jwnl_properties>
只是
<jwnl_properties language="en">
问题应该在那里消失,但它不会完全消失,因为如果我没记错的话,你的 <dictionary>
也被关闭了两次:在第 6 行和倒数第三行,您需要摆脱其中一个。如果你这样做,我认为你的 XML 将是合式的,尽管我可能遗漏了一些东西。
需要更改 file_properties 以便工作并遵守演示文件 here 我已经改变了它。但是这个错误仍然存在。我对XML不是很熟悉。谁能帮忙修复解析文件时出现的错误。
这是 xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<jwnl_properties language="en"/></jwnl_properties>
<version publisher="Princeton" number="3.0" language="en"/>
<dictionary class="net.didion.jwnl.dictionary.FileBackedDictionary">
<param name="dictionary_path" value="C:\Program Files\WordNet- 3.0.1\dict\"/>
</dictionary>
<param name="morphological_processor" value="net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor">
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
<param value="net.didion.jwnl.dictionary.morph.TokenizerOperation">
<param name="delimiters">
<param value=" "/>
<param value="-"/>
</param>
<param name="token_operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
<param value="net.didion.jwnl.dictionary.morph.DetachSuffixesOperation">
<param name="noun" value="|s=|ses=s|xes=x|zes=z|ches=ch|shes=sh|men=man|ies=y|"/>
<param name="verb" value="|s=|ies=y|es=e|es=|ed=e|ed=|ing=e|ing=|"/>
<param name="adjective" value="|er=|est=|er=e|est=e|"/>
<param name="operations">
<param value="net.didion.jwnl.dictionary.morph.LookupIndexWordOperation"/>
<param value="net.didion.jwnl.dictionary.morph.LookupExceptionsOperation"/>
</param>
</param>
</param>
</param>
</param>
</param>
<param name="dictionary_element_factory" value="net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory"/>
<param name="file_manager" value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type" value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile"/>
<param name="dictionary_path" value="c:\program files\wordnet-3.0.0\dict"/>
</param>
</dictionary>
<resource class="PrincetonResource"/>
</jwnl_properties>
这是获取词义的简单代码 运行 时发生的错误。程序似乎没有错误。
[Fatal Error] :2:35: The markup in the document following the root element must be well-formed.
net.didion.jwnl.JWNLException: Error parsing the properties file
at net.didion.jwnl.JWNL.initialize(JWNL.java:117)
at Summarization.main(Summarization.java:46)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 35; The markup in the document following the root element must be well-formed.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at net.didion.jwnl.JWNL.initialize(JWNL.java:115)
... 1 more
好像在你的XML中<jwnl_properties>
标签被关闭了三次,第一次它被设置为空元素(末尾的/>
),然后就被关闭了再次使用 </jwnl_properties>
然后你在文件末尾得到另一个 </jwnl_properties>
。
如果将第二行从
<jwnl_properties language="en"/></jwnl_properties>
只是
<jwnl_properties language="en">
问题应该在那里消失,但它不会完全消失,因为如果我没记错的话,你的 <dictionary>
也被关闭了两次:在第 6 行和倒数第三行,您需要摆脱其中一个。如果你这样做,我认为你的 XML 将是合式的,尽管我可能遗漏了一些东西。