File: automaton_remove_word.rst

package info (click to toggle)
python-pyahocorasick 1.4.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ansic: 4,552; python: 2,823; sh: 312; makefile: 242
file content (25 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
remove_word(word) -> bool
--------------------------------------------------------------------------------

Remove given word from a trie. Return True if words was found, False otherwise.

Examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    >>> import ahocorasick
    >>> A = ahocorasick.Automaton()
    >>> A.add_word("cat", 1)
    True
    >>> A.add_word("dog", 2)
    True
    >>> A.remove_word("cat")
    True
    >>> A.remove_word("cat")
    False
    >>> A.remove_word("dog")
    True
    >>> A.remove_word("dog")
    False
    >>>