repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
nltk-develop | nltk-develop/nltk/tokenize/repp.py | # Natural Language Toolkit: Interface to the Repp Tokenizer
#
# Copyright (C) 2001-2015 NLTK Project
# Authors: Rebecca Dridan and Stephan Oepen
# Contributors: Liling Tan
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import os
import re
import subprocess
import sys
import tempfile
from ... | 8,096 | 52.98 | 656 | py |
nltk-develop | nltk-develop/nltk/tokenize/destructive.py | # Natural Language Toolkit: NLTK's very own tokenizer.
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Liling Tan
# Tom Aarsen <> (modifications)
# URL: <https://www.nltk.org>
# For license information, see LICENSE.TXT
import re
import warnings
from typing import Iterator, List, Tuple
from nltk.tokenize.a... | 9,197 | 38.307692 | 118 | py |
nltk-develop | nltk-develop/nltk/tokenize/util.py | # Natural Language Toolkit: Tokenizer Utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org>
# For license information, see LICENSE.TXT
from re import finditer
from xml.sax.saxutils import escape, unescape
def string_span_tokenize(s, sep):
r... | 9,992 | 32.760135 | 132 | py |
nltk-develop | nltk-develop/nltk/tokenize/texttiling.py | # Natural Language Toolkit: TextTiling
#
# Copyright (C) 2001-2023 NLTK Project
# Author: George Boutsioukis
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import math
import re
try:
import numpy
except ImportError:
pass
from nltk.tokenize.api import TokenizerI
BLOCK_COMPARISON,... | 16,468 | 33.598739 | 101 | py |
nltk-develop | nltk-develop/nltk/tokenize/__init__.py | # Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# Contributors: matthewmc, clouds56
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
r"""
NLTK Tokenizer Pa... | 5,111 | 37.43609 | 88 | py |
nltk-develop | nltk-develop/nltk/tokenize/sexpr.py | # Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Yoav Goldberg <yoavg@cs.bgu.ac.il>
# Steven Bird <stevenbird1@gmail.com> (minor edits)
# URL: <https://www.nltk.org>
# For license information, see LICENSE.TXT
"""
S-Expression Tokenizer
``SExprTokenizer`` is used to fin... | 5,162 | 35.617021 | 88 | py |
nltk-develop | nltk-develop/nltk/tokenize/stanford_segmenter.py | #!/usr/bin/env python
# Natural Language Toolkit: Interface to the Stanford Segmenter
# for Chinese and Arabic
#
# Copyright (C) 2001-2023 NLTK Project
# Author: 52nlp <52nlpcn@gmail.com>
# Casper Lehmann-Strøm <casperlehmann@gmail.com>
# Alex Constantin <alex@keyworder.ch>
#
# URL: <https://www.nltk.or... | 9,509 | 31.457338 | 202 | py |
nltk-develop | nltk-develop/nltk/tokenize/casual.py | #
# Natural Language Toolkit: Twitter Tokenizer
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Christopher Potts <cgpotts@stanford.edu>
# Ewan Klein <ewan@inf.ed.ac.uk> (modifications)
# Pierpaolo Pantone <> (modifications)
# Tom Aarsen <> (modifications)
# URL: <https://www.nltk.org/>
# For... | 15,627 | 33.04793 | 119 | py |
nltk-develop | nltk-develop/nltk/tokenize/stanford.py | # Natural Language Toolkit: Interface to the Stanford Tokenizer
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Xu <xxu@student.unimelb.edu.au>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import json
import os
import tempfile
import warnings
from subprocess import PIPE
from n... | 3,760 | 31.422414 | 134 | py |
nltk-develop | nltk-develop/nltk/tokenize/nist.py | # Natural Language Toolkit: Python port of the mteval-v14.pl tokenizer.
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Liling Tan (ported from ftp://jaguar.ncsl.nist.gov/mt/resources/mteval-v14.pl)
# Contributors: Ozan Caglayan, Wiktor Stribizew
#
# URL: <https://www.nltk.org>
# For license information, see LICENSE... | 7,501 | 40.677778 | 182 | py |
nltk-develop | nltk-develop/nltk/tokenize/punkt.py | # Natural Language Toolkit: Punkt sentence tokenizer
#
# Copyright (C) 2001-2023 NLTK Project
# Algorithm: Kiss & Strunk (2006)
# Author: Willy <willy@csse.unimelb.edu.au> (original Python port)
# Steven Bird <stevenbird1@gmail.com> (additions)
# Edward Loper <edloper@gmail.com> (rewrite)
# Joel... | 67,037 | 36.917421 | 104 | py |
nltk-develop | nltk-develop/nltk/tokenize/treebank.py | # Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Michael Heilman <mheilman@cmu.edu> (re-port from http://www.cis.upenn.edu/~treebank/tokenizer.sed)
# Tom Aarsen <> (modifications)
#
# URL: <https://www.nltk.org>
# For license in... | 16,267 | 39.367246 | 126 | py |
nltk-develop | nltk-develop/nltk/corpus/europarl_raw.py | # Natural Language Toolkit: Europarl Corpus Readers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Nitin Madnani <nmadnani@umiacs.umd.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from nltk.corpus.reader import *
from nltk.corpus.util import LazyCorpusLoader
# Create a... | 1,840 | 31.298246 | 83 | py |
nltk-develop | nltk-develop/nltk/corpus/util.py | # Natural Language Toolkit: Corpus Reader Utility Functions
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
######################################################################
# { Lazy Corpus Loader
#######... | 5,713 | 35.864516 | 104 | py |
nltk-develop | nltk-develop/nltk/corpus/__init__.py | # Natural Language Toolkit: Corpus Readers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# TODO this docstring isn't up-to-date!
"""
NLTK corpus readers. The modules in this package provide functions
that c... | 17,047 | 30.80597 | 103 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/senseval.py | # Natural Language Toolkit: Senseval 2 Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Steven Bird <stevenbird1@gmail.com> (modifications)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Read from the Senseval 2 Corpus.
SENSEVAL... | 7,343 | 36.279188 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/mte.py | """
A reader for corpora whose documents are in MTE format.
"""
import os
import re
from functools import reduce
from nltk.corpus.reader import TaggedCorpusReader, concat
from nltk.corpus.reader.xmldocs import XMLCorpusView
def xpath(root, path, ns):
return root.findall(path, ns)
class MTECorpusView(XMLCorpusV... | 13,988 | 34.148241 | 108 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/propbank.py | # Natural Language Toolkit: PropBank Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from functools import total_ordering
from xml.etree import ElementTree
from nltk.corpus.reader.api ... | 17,256 | 32.122841 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/verbnet.py | # Natural Language Toolkit: Verbnet Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
An NLTK interface to the VerbNet verb lexicon
For details about VerbNet see:
https://verbs.colorado.edu/~m... | 24,774 | 38.325397 | 110 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/semcor.py | # Natural Language Toolkit: SemCor Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Nathan Schneider <nschneid@cs.cmu.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the SemCor Corpus.
"""
__docformat__ = "epytext en"
from nltk.corpus.reader.api im... | 11,398 | 37.380471 | 120 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/lin.py | # Natural Language Toolkit: Lin's Thesaurus
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Dan Blanchard <dblanchard@ets.org>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.txt
import re
from collections import defaultdict
from functools import reduce
from nltk.corpus.reader import CorpusRe... | 6,471 | 34.173913 | 104 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/knbc.py | #! /usr/bin/env python
# KNB Corpus reader
# Copyright (C) 2001-2023 NLTK Project
# Author: Masato Hagiwara <hagisan@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# For more information, see http://lilyx.net/pages/nltkjapanesecorpus.html
import re
from nltk.corpus.reader.api im... | 5,599 | 28.62963 | 92 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/pros_cons.py | # Natural Language Toolkit: Pros and Cons Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for the Pros and Cons dataset.
- Pros and Cons dataset information -
Contact:... | 4,763 | 34.552239 | 85 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/crubadan.py | # Natural Language Toolkit: An Crubadan N-grams Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Avital Pekker <avital.pekker@utoronto.ca>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
An NLTK interface for the n-gram statistics gathered from
the corpora for each language usi... | 3,521 | 31.915888 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/ppattach.py | # Natural Language Toolkit: PP Attachment Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Read lines from the Prepositional Phrase Attachment Cor... | 2,808 | 28.260417 | 96 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/dependency.py | # Natural Language Toolkit: Dependency Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Kepa Sarasola <kepa.sarasola@ehu.es>
# Iker Manterola <returntothehangar@hotmail.com>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.api import *
from nlt... | 3,775 | 31.551724 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/ieer.py | # Natural Language Toolkit: IEER Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the Information Extraction and Entity Recognit... | 3,686 | 30.512821 | 86 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/chunked.py | # Natural Language Toolkit: Chunked Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader for corpora that contain chunked (and optionally tag... | 9,093 | 32.189781 | 82 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/tagged.py | # Natural Language Toolkit: Tagged Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Jacob Perkins <japerk@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader for corpor... | 11,786 | 32.202817 | 82 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/comparative_sents.py | # Natural Language Toolkit: Comparative Sentence Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for the Comparative Sentence Dataset.
- Comparative Sentence Dataset in... | 11,760 | 36.93871 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/sentiwordnet.py | # Natural Language Toolkit: SentiWordNet
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Christopher Potts <cgpotts@stanford.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
An NLTK interface for SentiWordNet
SentiWordNet is a lexical resource for opinion mining.
SentiWordNet assi... | 4,490 | 31.781022 | 84 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/framenet.py | # Natural Language Toolkit: Framenet Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Chuck Wooters <wooters@icsi.berkeley.edu>,
# Nathan Schneider <nathan.schneider@georgetown.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the FrameNet 1... | 131,349 | 37.149869 | 184 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/wordlist.py | # Natural Language Toolkit: Word List Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.api import *
from nltk.corpus.reader.uti... | 5,646 | 32.814371 | 201 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/ycoe.py | # Natural Language Toolkit: York-Toronto-Helsinki Parsed Corpus of Old English Prose (YCOE)
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Selina Dennis <selina@tranzfusion.net>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the York-Toronto-Helsinki Parsed Corpus o... | 10,228 | 38.801556 | 91 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/xmldocs.py | # Natural Language Toolkit: XML Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for corpora whose documents are xml files.
(note -- not named 'xml' to avoid conflicting w/ s... | 15,888 | 38.922111 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/panlex_swadesh.py | # Natural Language Toolkit: Word List Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from collections import defaultdict, namedtuple
fro... | 3,192 | 32.260417 | 100 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/string_category.py | # Natural Language Toolkit: String Category Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Read tuples from a corpus consisting of categorized s... | 1,863 | 31.701754 | 84 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/markdown.py | from collections import namedtuple
from functools import partial, wraps
from nltk.corpus.reader.api import CategorizedCorpusReader
from nltk.corpus.reader.plaintext import PlaintextCorpusReader
from nltk.corpus.reader.util import concat, read_blankline_block
from nltk.tokenize import blankline_tokenize, sent_tokenize,... | 11,744 | 33.043478 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/pl196x.py | # Natural Language Toolkit:
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Piotr Kasprzyk <p.j.kasprzyk@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.api import *
from nltk.corpus.reader.xmldocs import XMLCorpusReader
PARA = re.compile(r"<p(?: [^>]*){... | 11,945 | 30.771277 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/nkjp.py | # Natural Language Toolkit: NKJP Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Gabriela Kaczka
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import functools
import os
import re
import tempfile
from nltk.corpus.reader.util import concat
from nltk.corpus.reader.xmldocs im... | 15,845 | 31.471311 | 116 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/api.py | # Natural Language Toolkit: API for Corpus Readers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
API for corpus readers.
"""
import os
import re
from collec... | 19,155 | 36.052224 | 86 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/reviews.py | # Natural Language Toolkit: Product Reviews Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for reviews corpora (syntax based on Customer Review Corpus).
Customer Revie... | 11,990 | 35.11747 | 125 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/rte.py | # Natural Language Toolkit: RTE Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the Recognizing Textual Entailment (RTE) Challenge Corpora.
The files were taken from the RTE... | 4,639 | 30.564626 | 98 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/panlex_lite.py | # Natural Language Toolkit: PanLex Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: David Kamholz <kamholz@panlex.org>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for PanLex Lite, a stripped down version of PanLex distributed
as an SQLite database. See the... | 5,266 | 29.097143 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/sinica_treebank.py | # Natural Language Toolkit: Sinica Treebank Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Sinica Treebank Corpus Sample
http://rocling.iis.sinica.edu.tw/CKIP/engversion/treebank.htm
10,000 pa... | 2,466 | 31.460526 | 79 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/twitter.py | # Natural Language Toolkit: Twitter Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader for corpora that consist of Tweets. It is assumed that the Tweets
have been serialised into line-del... | 4,472 | 31.649635 | 91 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/udhr.py | """
UDHR corpus reader. It mostly deals with encodings.
"""
from nltk.corpus.reader.plaintext import PlaintextCorpusReader
from nltk.corpus.reader.util import find_corpus_fileids
class UdhrCorpusReader(PlaintextCorpusReader):
ENCODINGS = [
(".*-Latin1$", "latin-1"),
(".*-Hebrew$", "hebrew"),
... | 2,517 | 32.131579 | 70 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/util.py | # Natural Language Toolkit: Corpus Reader Utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import bisect
import os
import pickle
import re
import tempfile... | 31,358 | 35.12788 | 86 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/chasen.py | #
# Copyright (C) 2001-2023 NLTK Project
# Author: Masato Hagiwara <hagisan@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import sys
from nltk.corpus.reader import util
from nltk.corpus.reader.api import *
from nltk.corpus.reader.util import *
class ChasenCorpusReader(CorpusRe... | 4,541 | 27.566038 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/categorized_sents.py | # Natural Language Toolkit: Categorized Sentences Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader structured for corpora that contain one instance on each row.
This Corp... | 6,053 | 34.822485 | 84 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/bnc.py | # Natural Language Toolkit: Plaintext Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Corpus reader for the XML version of the British National Corpus."""
from nltk.corpus.reader.util import ... | 9,451 | 34.533835 | 94 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/cmudict.py | # Natural Language Toolkit: Carnegie Mellon Pronouncing Dictionary Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
The Carnegie Mellon Pronouncing Dictionary [cmudict.0.6]
ftp://ftp.cs.cmu... | 3,278 | 35.842697 | 80 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/childes.py | # CHILDES XML Corpus Reader
# Copyright (C) 2001-2023 NLTK Project
# Author: Tomonori Nagano <tnagano@gc.cuny.edu>
# Alexis Dimitriadis <A.Dimitriadis@uu.nl>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the XML version of the CHILDES corpus.
"""
__docformat_... | 25,475 | 39.37401 | 103 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/indian.py | # Natural Language Toolkit: Indian Language POS-Tagged Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Indian Language POS-Tagged Corpus
Collecte... | 2,921 | 30.085106 | 85 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/nombank.py | # Natural Language Toolkit: NomBank Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Paul Bedaride <paul.bedaride@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from functools import total_ordering
from xml.etree import ... | 15,781 | 32.794433 | 84 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/__init__.py | # Natural Language Toolkit: Corpus Readers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
NLTK corpus readers. The modules in this package provide functions
... | 6,491 | 33.716578 | 72 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/plaintext.py | # Natural Language Toolkit: Plaintext Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# Nitin Madnani <nmadnani@umiacs.umd.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader ... | 8,229 | 35.096491 | 100 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/bracket_parse.py | # Natural Language Toolkit: Penn Treebank Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for corpora that consist of parenthesis-delineate... | 9,382 | 38.42437 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/ipipan.py | # Natural Language Toolkit: IPI PAN Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Konrad Goluchowski <kodie@mimuw.edu.pl>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import functools
from nltk.corpus.reader.api import CorpusReader
from nltk.corpus.reader.util import St... | 12,736 | 34.677871 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/nps_chat.py | # Natural Language Toolkit: NPS Chat Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
import textwrap
from nltk.corpus.reader.api import *
from nltk.corpus.reader.util import *
from nlt... | 2,850 | 30.32967 | 84 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/timit.py | # Natural Language Toolkit: TIMIT Corpus Reader
#
# Copyright (C) 2001-2007 NLTK Project
# Author: Haejoong Lee <haejoong@ldc.upenn.edu>
# Steven Bird <stevenbird1@gmail.com>
# Jacob Perkins <japerk@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# [xx] this docstri... | 17,963 | 34.154599 | 88 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/opinion_lexicon.py | # Natural Language Toolkit: Opinion Lexicon Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for the Opinion Lexicon.
Opinion Lexicon information
=======================... | 4,105 | 31.587302 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/bcp47.py | # Natural Language Toolkit: BCP-47 language tags
#
# Copyright (C) 2022-2023 NLTK Project
# Author: Eric Kafe <kafe.eric@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from warnings import warn
from xml.etree import ElementTree as et
from nltk.corpus.reader import Corpu... | 8,314 | 36.968037 | 86 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/conll.py | # Natural Language Toolkit: CONLL Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Read CoNLL-style chunk fileids.
"""
import textwrap
from nltk... | 21,722 | 36.453448 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/wordnet.py | # Natural Language Toolkit: WordNet
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bethard <Steven.Bethard@colorado.edu>
# Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# Nitin Madnani <nmadnani@ets.org>
# Nasruddin A’aidil Shari
# Sim Wei Ying... | 91,611 | 35.542481 | 113 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/toolbox.py | # Natural Language Toolkit: Toolbox Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# Stuart Robinson <Stuart.Robinson@mpi.nl>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Module for readi... | 2,045 | 25.571429 | 87 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/aligned.py | # Natural Language Toolkit: Aligned Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# Author: Steven Bird <stevenbird1@gmail.com>
# For license information, see LICENSE.TXT
from nltk.corpus.reader.api import CorpusReader
from nltk.corpus.reader.util import (
StreamBackedCorpus... | 4,851 | 30.303226 | 81 | py |
nltk-develop | nltk-develop/nltk/corpus/reader/switchboard.py | # Natural Language Toolkit: Switchboard Corpus Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from nltk.corpus.reader.api import *
from nltk.corpus.reader.util import *
from nltk.tag import m... | 4,422 | 34.103175 | 88 | py |
nltk-develop | nltk-develop/nltk/misc/babelfish.py | """
This module previously provided an interface to Babelfish online
translation service; this service is no longer available; this
module is kept in NLTK source code in order to provide better error
messages for people following the NLTK Book 2.0.
"""
def babelize_shell():
print("Babelfish online translation ser... | 351 | 31 | 73 | py |
nltk-develop | nltk-develop/nltk/misc/sort.py | # Natural Language Toolkit: List Sorting
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides a variety of list sorting algorithms, to
illustrate the many different algorithms (recipes) ... | 4,371 | 23.700565 | 80 | py |
nltk-develop | nltk-develop/nltk/misc/chomsky.py | # Chomsky random text generator, version 1.1, Raymond Hettinger, 2005/09/13
# https://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440546
"""
CHOMSKY is an aid to writing linguistic papers in the style
of the great master. It is based on selected phrases taken
from actual books and articles written by Noam Chomsk... | 5,185 | 37.414815 | 79 | py |
nltk-develop | nltk-develop/nltk/misc/wordfinder.py | # Natural Language Toolkit: Word Finder
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# Simplified from PHP version by Robert Klein <brathna@gmail.com>
# http://fswordfinder.sourceforge.net/
import rando... | 4,213 | 29.1 | 88 | py |
nltk-develop | nltk-develop/nltk/misc/__init__.py | # Natural Language Toolkit: Miscellaneous modules
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.misc.babelfish import babelize_shell
from nltk.misc.chomsky import generate_chomsky
from nltk.misc... | 395 | 32 | 49 | py |
nltk-develop | nltk-develop/nltk/misc/minimalset.py | # Natural Language Toolkit: Minimal Sets
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from collections import defaultdict
class MinimalSet:
"""
Find contexts where more than one possible target... | 2,894 | 32.662791 | 77 | py |
nltk-develop | nltk-develop/nltk/chat/eliza.py | # Natural Language Toolkit: Eliza
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# Based on an Eliza implementation by Joe Strout <joe@strout.net>,
# Jeff Epler... | 9,289 | 26.485207 | 89 | py |
nltk-develop | nltk-develop/nltk/chat/rude.py | # Natural Language Toolkit: Rude Chatbot
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Peter Spiller <pspiller@csse.unimelb.edu.au>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.chat.util import Chat, reflections
pairs = (
(
r"We (.*)",
(
"Wha... | 3,164 | 24.119048 | 83 | py |
nltk-develop | nltk-develop/nltk/chat/util.py | # Natural Language Toolkit: Chatbot Utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# Based on an Eliza implementation by Joe Strout <joe@strout.net>,
# Jeff Epler <jepler@inetnebr.com> and Jez H... | 3,890 | 30.128 | 89 | py |
nltk-develop | nltk-develop/nltk/chat/zen.py | # Natural Language Toolkit: Zen Chatbot
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Amy Holland <amyrh@csse.unimelb.edu.au>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Zen Chatbot talks in gems of Zen wisdom.
This is a sample conversation with Zen Chatbot:
ZC: Welcome, my c... | 11,350 | 33.39697 | 200 | py |
nltk-develop | nltk-develop/nltk/chat/__init__.py | # Natural Language Toolkit: Chatbots
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# Based on an Eliza implementation by Joe Strout <joe@strout.net>,
# Jeff Epler <jepler@inetnebr.com> and Jez Higgins <j... | 1,508 | 29.795918 | 80 | py |
nltk-develop | nltk-develop/nltk/chat/iesha.py | # Natural Language Toolkit: Teen Chatbot
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Selina Dennis <sjmd@csse.unimelb.edu.au>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This chatbot is a tongue-in-cheek take on the average teen
anime junky that frequents YahooMessenger or MSNM... | 4,247 | 25.385093 | 85 | py |
nltk-develop | nltk-develop/nltk/chat/suntsu.py | # Natural Language Toolkit: Sun Tsu-Bot
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Sam Huston 2007
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Tsu bot responds to all queries with a Sun Tsu sayings
Quoted from Sun Tsu's The Art of War
Translated by LIONEL GILES, M.A. 1910
Hos... | 7,045 | 48.971631 | 198 | py |
nltk-develop | nltk-develop/nltk/lm/vocabulary.py | # Natural Language Toolkit
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Language Model Vocabulary"""
import sys
from collections import Counter
from collections.abc import Iterable
from functools ... | 6,881 | 30.424658 | 86 | py |
nltk-develop | nltk-develop/nltk/lm/preprocessing.py | # Natural Language Toolkit: Language Model Unit Tests
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from functools import partial
from itertools import chain
from nltk.util import everygrams, pad_sequ... | 1,663 | 31 | 91 | py |
nltk-develop | nltk-develop/nltk/lm/api.py | # Natural Language Toolkit: Language Models
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Language Model Interface."""
import random
import warnings
from abc import ABCMeta, abstractmethod
from bi... | 8,260 | 34.004237 | 94 | py |
nltk-develop | nltk-develop/nltk/lm/util.py | # Natural Language Toolkit
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Language Model Utilities"""
from math import log
NEG_INF = float("-inf")
POS_INF = float("inf")
def log_base2(score):
... | 455 | 21.8 | 68 | py |
nltk-develop | nltk-develop/nltk/lm/models.py | # Natural Language Toolkit: Language Models
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# Manu Joseph <manujosephv@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Language Models"""
from nltk.lm.api import LanguageModel, Smo... | 4,762 | 32.542254 | 86 | py |
nltk-develop | nltk-develop/nltk/lm/__init__.py | # Natural Language Toolkit: Language Models
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/
# For license information, see LICENSE.TXT
"""
NLTK Language Modeling Module.
------------------------------
Currently this module covers only ngram lang... | 7,816 | 32.122881 | 102 | py |
nltk-develop | nltk-develop/nltk/lm/counter.py | # Natural Language Toolkit
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Language Model Counter
----------------------
"""
from collections import defaultdict
from collections.abc import Sequence
... | 5,087 | 30.02439 | 96 | py |
nltk-develop | nltk-develop/nltk/lm/smoothing.py | # Natural Language Toolkit: Language Model Unit Tests
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
# Manu Joseph <manujosephv@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Smoothing algorithms for language modeling.
Accordi... | 4,618 | 35.085938 | 101 | py |
nltk-develop | nltk-develop/nltk/parse/projectivedependencyparser.py | # Natural Language Toolkit: Dependency Grammars
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Jason Narad <jason.narad@gmail.com>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
#
from collections import defaultdict
from functools import total_ordering
from itertools import chain
from... | 27,527 | 37.393305 | 186 | py |
nltk-develop | nltk-develop/nltk/parse/transitionparser.py | # Natural Language Toolkit: Arc-Standard and Arc-eager Transition Based Parsers
#
# Author: Long Duong <longdt219@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import pickle
import tempfile
from copy import deepcopy
from operator import it... | 31,478 | 38.596226 | 186 | py |
nltk-develop | nltk-develop/nltk/parse/featurechart.py | # Natural Language Toolkit: Chart Parser for Feature-Based Grammars
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Rob Speer <rspeer@mit.edu>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Extension of chart parsing implementat... | 21,857 | 31.382222 | 86 | py |
nltk-develop | nltk-develop/nltk/parse/evaluate.py | # Natural Language Toolkit: evaluation of dependency parser
#
# Author: Long Duong <longdt219@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import unicodedata
class DependencyEvaluator:
"""
Class for measuring labelled and unlabe... | 4,339 | 32.384615 | 87 | py |
nltk-develop | nltk-develop/nltk/parse/recursivedescent.py | # Natural Language Toolkit: Recursive Descent Parser
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.grammar import Nonterminal
from nltk.parse.api impor... | 25,348 | 36.005839 | 87 | py |
nltk-develop | nltk-develop/nltk/parse/bllip.py | # Natural Language Toolkit: Interface to BLLIP Parser
#
# Author: David McClosky <dmcc@bigasterisk.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.parse.api import ParserI
from nltk.tree import Tree
"""
Interface for parsing with BLLIP ... | 10,677 | 34.593333 | 81 | py |
nltk-develop | nltk-develop/nltk/parse/generate.py | # Natural Language Toolkit: Generating from a CFG
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
#
import itertools
import sys
from nltk.grammar im... | 2,295 | 25.697674 | 76 | py |
nltk-develop | nltk-develop/nltk/parse/earleychart.py | # Natural Language Toolkit: An Incremental Earley Chart Parser
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# Rob Speer <rspeer@mit.edu>
# Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Jean Mark Gawron <gawro... | 17,721 | 31.047016 | 86 | py |
nltk-develop | nltk-develop/nltk/parse/corenlp.py | # Natural Language Toolkit: Interface to the CoreNLP REST API.
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Dmitrijs Milajevs <dimazest@gmail.com>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import json
import os # required for doctests
import re
import socket
import time
from ty... | 26,943 | 32.637953 | 138 | py |
nltk-develop | nltk-develop/nltk/parse/shiftreduce.py | # Natural Language Toolkit: Shift-Reduce Parser
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.grammar import Nonterminal
from nltk.parse.api import Par... | 16,592 | 33.56875 | 80 | py |
nltk-develop | nltk-develop/nltk/parse/pchart.py | # Natural Language Toolkit: Probabilistic Chart Parsers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classes and interfaces for associating probabilities wi... | 19,901 | 33.313793 | 87 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.