Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
taishi-i committed Jun 17, 2018
1 parent baa51bb commit 9531d75
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 75 deletions.
16 changes: 12 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
.. nagisa documentation master file, created by
sphinx-quickstart on Wed Jun 13 00:32:26 2018.
sphinx-quickstart on Wed Jun 13 23:53:38 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to nagisa's documentation!
==================================
nagisa documentation
====================

| Nagisa is a python module for Japanese word segmentation/POS-tagging.
| It is designed to be a simple and easy-to-use tool.
This tool has the following features.
- Based on recurrent neural networks.
- The word segmentation model uses character- and word-level features.
- The POS-tagging model uses tag dictionary information.

.. toctree::
:maxdepth: 2
:caption: Contents:

introduction
nagisa


Indices and tables
==================

Expand Down
51 changes: 0 additions & 51 deletions docs/nagisa.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
nagisa package
==============

Submodules
----------

nagisa.mecab\_system\_eval module
---------------------------------

.. automodule:: nagisa.mecab_system_eval
:members:
:undoc-members:
:show-inheritance:

nagisa.model module
-------------------

.. automodule:: nagisa.model
:members:
:undoc-members:
:show-inheritance:

nagisa.prepro module
--------------------

.. automodule:: nagisa.prepro
:members:
:undoc-members:
:show-inheritance:

nagisa.tagger module
--------------------

Expand All @@ -36,27 +9,3 @@ nagisa.tagger module
:undoc-members:
:show-inheritance:

nagisa.train module
-------------------

.. automodule:: nagisa.train
:members:
:undoc-members:
:show-inheritance:

nagisa.utils module
-------------------

.. automodule:: nagisa.utils
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: nagisa
:members:
:undoc-members:
:show-inheritance:
69 changes: 49 additions & 20 deletions nagisa/tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ class Tagger(object):
"""
This class has a word segmentation function and a POS-tagging function for Japanese.
"""
def __init__(self, vocabs=base+'/data/nagisa_v001.dict',
params=base+'/data/nagisa_v001.model',
hp=base+'/data/nagisa_v001.hp',
single_word_list=None):

def __init__(self, vocabs=None, params=None, hp=None, single_word_list=None):
if vocabs is None:
vocabs = base + '/data/nagisa_v001.dict'
if params is None:
params = base + '/data/nagisa_v001.model'
if hp is None:
hp = base + '/data/nagisa_v001.hp'

# Load vocaburary files
vocabs = utils.load_data(vocabs)
self._uni2id, self._bi2id, self._word2id, self._pos2id, self._word2postags = vocabs
Expand All @@ -41,10 +46,15 @@ def __init__(self, vocabs=base+'/data/nagisa_v001.dict',


def wakati(self, text, lower=False):
"""
Return the words of the given sentence.
Input: str (a sentence)
Output: the list of the words
"""Return the words of the given sentence.
args:
- text (str): An input sentence.
- lower (bool): If lower is True, all uppercase characters in a list \
of the words are converted into lowercase characters.
return:
- words (list): A list of the words.
"""
text = utils.preprocess(text)
lower_text = text.lower()
Expand Down Expand Up @@ -87,10 +97,14 @@ def wakati(self, text, lower=False):


def tagging(self, text, lower=False):
"""
Return the words with POS-tags of the given sentence.
Input: str (a sentence)
Output: the object of the words with POS-tags
""" Return the words with POS-tags of the given sentence.
args:
- text (str): An input sentence.
- lower (bool): If lower is True, all uppercase characters in a list \
of the words are converted into lowercase characters.
return:
- object : The object of the words with POS-tags.
"""
words = self.wakati(text, lower)

Expand All @@ -117,10 +131,17 @@ def tagging(self, text, lower=False):


def filter(self, text, lower=False, filter_postags=[]):
"""
Return the filtered words with POS-tags of the given sentence.
Input: str (a sentence)
Output: the object of the words with POS-tags
"""Return the filtered words with POS-tags of the given sentence.
args:
- text (str): An input sentence.
- lower (bool): If lower is True, all uppercase characters in a list \
of the words are converted into lowercase characters.
- filter_postags (list): Filtering the word with the POS-tag in \
filter_postags from a text.
return:
- object : The object of the words with POS-tags.
"""
words = []
postags = []
Expand All @@ -133,10 +154,18 @@ def filter(self, text, lower=False, filter_postags=[]):


def extract(self, text, lower=False, extract_postags=[]):
"""
Return the extracted words with POS-tags of the given sentence.
Input: str (a sentence)
Output: the object of the words with POS-tags
"""Return the extracted words with POS-tags of the given sentence.
args:
- text (str): An input sentence.
- lower (bool): If lower is True, all uppercase characters in a list \
of the words are converted into lowercase characters.
- filter_postags (list): Extracting the word with the POS-tag in \
filter_postags from a text.
return:
- object : The object of the words with POS-tags.
"""
words = []
postags = []
Expand Down

0 comments on commit 9531d75

Please sign in to comment.