我一直在从事一个与Senna接口的项目,Senna是使用Python处理NLP时使用的工具。为了方便地生成文档,我采用了reStructuredText文档风格,这是非常容易的。
在调用make html时,很少有时间(有时没有警告)显示有警告,例如
Pntl.tools.Annotator.test:2的docstring :警告:字段列表结束时没有空行;意外的无缩进,还有一件事,在工作中显示这个数字2的用途是什么。
def test(senna_path="/media/jawahar/jon/ubuntu/senna", sent="", dep_model="", batch=False,
jar_path="/media/jawahar/jon/ubuntu/practNLPTools-lite/pntl"):
"""please replace the path of yours environment(accouding to OS path)
:parama str senna_path: path for senna location
:parama str dep_model: stanford dependency parser model location
:parama str or list sent: the sentense to process with Senna
:parama bool batch: makeing as batch process with one or more sentense passing
:parama str jar_path: location of stanford-parser.jar file
"""发布于 2017-05-26 00:20:14
此错误指示您的语法不正确,特别是说明和字段列表周围没有空行,而且缩进不正确。太空很重要。
拼写也很重要。你可能是说:param blah blah: thing而不是:parama blah blah: thing:
有关详细信息,请参阅信息字段列表。
编辑
下面的示例应修复此问题。注意"param“的正确拼写,以及将参数列表与docstring中的描述分隔开的必要的行间隔。此外,为了避免代码中的PEP8警告(在这种情况下,reStructuredText并不关心),您应该按照方法定义中的说明对长行进行包装。参数列表中还有另一个新行,这样Sphinx将正确地呈现它,并避免PEP8警告。
def test(senna_path="/media/jawahar/jon/ubuntu/senna", sent="", dep_model="",
batch=False,
jar_path="/media/jawahar/jon/ubuntu/practNLPTools-lite/pntl"):
"""
please replace the path of yours environment(accouding to OS path)
:param str senna_path: path for senna location
:param str dep_model: stanford dependency parser model location
:param str or list sent: the sentense to process with Senna
:param bool batch: makeing as batch process with one or more sentense
passing
:param str jar_path: location of stanford-parser.jar file
"""https://stackoverflow.com/questions/44185203
复制相似问题