gpt4 book ai didi

java - 使用关于 file_properties.xml 的 jwnl(Java WordNet 库)

转载 作者:行者123 更新时间:2023-12-01 11:43:22 25 4
gpt4 key购买 nike

需要更改 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\2.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\2.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 将是格式良好的,尽管我可能错过了一些内容。

关于java - 使用关于 file_properties.xml 的 jwnl(Java WordNet 库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29329297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com