2017-05-25 71 views
0

我一直在努力與Senna交互,這是在使用Python的NLP處理中使用的工具。爲了便於生成文檔,我使用了reStructuredText文檔樣式,這非常簡單。sphinx:沒有從docstring的內容更新HTML內容

在調用make html,很少時間(並且有時沒有警告)已經示出像pntl.tools.Annotator.test的

文檔字符串警告:2:警告:字段列表結束,而不一個空行意外的unindent和另外一件事情是什麼是使用這個數字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 
    """ 

built result的形象是被連接到顯示錯誤的HTML內容。有關我的項目的詳細信息,請參見此link

回答

1

錯誤表明您的語法不正確,特別是描述和字段列表周圍沒有空行,並且縮進不正確。白色空間很重要。

拼寫也很重要。您可能的意思是:param blah blah: thing而不是:parama blah blah: thing:

有關更多信息,請參閱Info field lists

編輯

下面的例子應該可以解決這個問題。請注意「參數」的正確拼寫,以及將參數列表與文檔字符串中的描述分開的必要換行符。另外,爲了避免代碼中出現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 
    """ 
+0

我是一種新的獅身人面像,所以請將上述文檔字符串糾正爲正確的格式,並將它們顯示在答案中。知道**會很好,可以看出我所做的錯誤**。 – jawahar