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 |
|---|---|---|---|---|---|---|
visual-semantic-embedding | visual-semantic-embedding-master/evaluation.py | """
Evaluation code for multimodal-ranking
"""
import numpy
from datasets import load_dataset
from tools import encode_sentences, encode_images
def evalrank(model, data, split='dev'):
"""
Evaluate a trained model on either dev or test
data options: f8k, f30k, coco
"""
print 'Loading dataset'
i... | 2,810 | 28.904255 | 75 | py |
visual-semantic-embedding | visual-semantic-embedding-master/train.py | """
Main trainer function
"""
import theano
import theano.tensor as tensor
import cPickle as pkl
import numpy
import copy
import os
import warnings
import sys
import time
import homogeneous_data
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from utils import *
from layers import get_layer, ... | 7,091 | 30.52 | 111 | py |
nltk-develop | nltk-develop/setup.py | #!/usr/bin/env python
#
# Setup script for the Natural Language Toolkit
#
# Copyright (C) 2001-2023 NLTK Project
# Author: NLTK Team <nltk.team@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# Work around mbcs bug in distutils.
# https://bugs.python.org/issue10945
import codecs
t... | 3,750 | 28.769841 | 83 | py |
nltk-develop | nltk-develop/tools/find_deprecated.py | #!/usr/bin/env python
#
# Natural Language Toolkit: Deprecated Function & Class Finder
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This command-line tool takes a list of python files or directories,
a... | 8,757 | 32.174242 | 88 | py |
nltk-develop | nltk-develop/tools/global_replace.py | #!/usr/bin/env python
#
# Natural Language Toolkit: substitute a pattern with
# a replacement in every file
# 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, ... | 1,669 | 25.507937 | 63 | py |
nltk-develop | nltk-develop/web/conf.py | #
# NLTK documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 2 17:02:59 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have ... | 11,827 | 33.483965 | 163 | py |
nltk-develop | nltk-develop/nltk/internals.py | # Natural Language Toolkit: Internal utility functions
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# Nitin Madnani <nmadnani@ets.org>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import fnmatch
im... | 38,293 | 33.069395 | 99 | py |
nltk-develop | nltk-develop/nltk/probability.py | # Natural Language Toolkit: Probability and Statistics
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (additions)
# Trevor Cohn <tacohn@cs.mu.oz.au> (additions)
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se> (additions)... | 90,330 | 34.025591 | 107 | py |
nltk-develop | nltk-develop/nltk/featstruct.py | # Natural Language Toolkit: Feature Structures
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>,
# Rob Speer,
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org>
# For license information, see LICENSE.TXT
"""
Basic data classes for representing feature... | 103,329 | 36.169065 | 104 | py |
nltk-develop | nltk-develop/nltk/jsontags.py | # Natural Language Toolkit: JSON Encoder/Decoder Helpers
#
# 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
"""
Register JSON tags, so the nltk data loader knows what module and class to look for.
NLTK u... | 1,883 | 27.545455 | 84 | py |
nltk-develop | nltk-develop/nltk/tgrep.py | #!/usr/bin/env python
#
# Natural Language Toolkit: TGrep search
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Will Roberts <wildwilhelm@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
============================================
TGrep search implementation for NLTK trees... | 36,872 | 34.454808 | 103 | py |
nltk-develop | nltk-develop/nltk/langnames.py | # Natural Language Toolkit: Language Codes
#
# Copyright (C) 2022-2023 NLTK Project
# Author: Eric Kafe <kafe.eric@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
#
# iso639-3 language codes (C) https://iso639-3.sil.org/
"""
Translate between language names and language codes.
The... | 17,186 | 22.511628 | 79 | py |
nltk-develop | nltk-develop/nltk/collocations.py | # Natural Language Toolkit: Collocations and Association Measures
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Joel Nothman <jnothman@student.usyd.edu.au>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Tools to identify collocations --- words that often appear consecutively
--- wi... | 14,552 | 34.237288 | 97 | py |
nltk-develop | nltk-develop/nltk/downloader.py | # Natural Language Toolkit: Corpus & Model Downloader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
The NLTK corpus and module downloader. This module defines several
interfaces which can be used to dow... | 92,947 | 35.307813 | 91 | py |
nltk-develop | nltk-develop/nltk/treetransforms.py | # Natural Language Toolkit: Tree Transformations
#
# Copyright (C) 2005-2007 Oregon Graduate Institute
# Author: Nathan Bodenstab <bodenstab@cslu.ogi.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
r"""
A collection of methods for tree (grammar) transformations used
in parsing natural la... | 5,162 | 39.653543 | 78 | py |
nltk-develop | nltk-develop/nltk/data.py | # Natural Language Toolkit: 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
"""
Functions to find and load NLTK resource files, such as corpora,
grammars, and saved processing objects. Resou... | 51,373 | 34.626907 | 97 | py |
nltk-develop | nltk-develop/nltk/wsd.py | # Natural Language Toolkit: Word Sense Disambiguation Algorithms
#
# Authors: Liling Tan <alvations@gmail.com>,
# Dmitrijs Milajevs <dimazest@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus import wordnet
def lesk... | 1,800 | 32.981132 | 96 | py |
nltk-develop | nltk-develop/nltk/cli.py | # Natural Language Toolkit: NLTK Command-Line Interface
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import click
from tqdm import tqdm
from nltk import word_tokenize
from nltk.util import parallelize_preprocess
CONTEXT_SETTINGS = dict(help_optio... | 1,842 | 31.910714 | 85 | py |
nltk-develop | nltk-develop/nltk/text.py | # Natural Language Toolkit: Texts
#
# 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
"""
This module brings together a variety of NLTK functionality for
text analysis... | 28,130 | 35.065385 | 89 | py |
nltk-develop | nltk-develop/nltk/help.py | # Natural Language Toolkit (NLTK) Help
#
# Copyright (C) 2001-2023 NLTK Project
# Authors: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Provide structured access to documentation.
"""
import re
from textwrap import wrap
from nltk.data import load
... | 1,645 | 24.323077 | 79 | py |
nltk-develop | nltk-develop/nltk/util.py | # Natural Language Toolkit: Utility functions
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Eric Kafe <kafe.eric@gmail.com> (acyclic closures)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import inspect
import locale
import os
import pydoc... | 40,810 | 32.5341 | 346 | py |
nltk-develop | nltk-develop/nltk/grammar.py | # Natural Language Toolkit: Context Free Grammars
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# Jason Narad <jason.narad@gmail.com>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# Tom Aarsen <>
# URL: <https... | 57,505 | 32.62924 | 105 | py |
nltk-develop | nltk-develop/nltk/lazyimport.py | # This module is from mx/DateTime/LazyModule.py and is
# distributed under the terms of the eGenix.com Public License Agreement
# https://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf
""" Helper to enable simple lazy module import.
'Lazy' means the actual import is deferred until an attribute is
... | 4,577 | 31.013986 | 79 | py |
nltk-develop | nltk-develop/nltk/__init__.py | # Natural Language Toolkit (NLTK)
#
# 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
"""
The Natural Language Toolkit (NLTK) is an open source Python library
for Na... | 6,223 | 28.638095 | 95 | py |
nltk-develop | nltk-develop/nltk/treeprettyprinter.py | # Natural Language Toolkit: ASCII visualization of NLTK trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Andreas van Cranenburgh <A.W.vanCranenburgh@uva.nl>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Pretty-printing of discontin... | 946 | 31.655172 | 93 | py |
nltk-develop | nltk-develop/nltk/compat.py | # Natural Language Toolkit: Compatibility
#
# Copyright (C) 2001-2023 NLTK Project
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import os
from functools import wraps
# ======= Compatibility for datasets that care about Python versions ========
# The following datasets have a /PY3 subdi... | 1,264 | 27.75 | 77 | py |
nltk-develop | nltk-develop/nltk/collections.py | # Natural Language Toolkit: Collections
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import bisect
# this unused import is for python 2.7
from collections import Counter, defaultdict, deque
from functoo... | 23,012 | 33.76284 | 89 | py |
nltk-develop | nltk-develop/nltk/book.py | # Natural Language Toolkit: Some texts for exploration in chapter 1 of the book
#
# 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.corpus import (
genesis,
gutenberg,
inaugural,
nps... | 3,699 | 16.28972 | 80 | py |
nltk-develop | nltk-develop/nltk/decorators.py | """
Decorator module by Michele Simionato <michelesimionato@libero.it>
Copyright Michele Simionato, distributed under the terms of the BSD License (see below).
http://www.phyast.pitt.edu/~micheles/python/documentation.html
Included in NLTK for its support of a nice memoization decorator.
"""
__docformat__ = "restruct... | 8,275 | 31.84127 | 88 | py |
nltk-develop | nltk-develop/nltk/toolbox.py | # Natural Language Toolkit: Toolbox Reader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Module for reading, writing and manipulating
Toolbox databases and settings files.
"""
import codecs
import re
f... | 17,813 | 32.931429 | 92 | py |
nltk-develop | nltk-develop/nltk/chunk/regexp.py | # Natural Language Toolkit: Regular Expression Chunkers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
import regex
from nltk.chunk.... | 54,505 | 35.928184 | 99 | py |
nltk-develop | nltk-develop/nltk/chunk/api.py | # Natural Language Toolkit: Chunk parsing API
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
##/////////////////////////////////////////////////... | 1,890 | 32.175439 | 75 | py |
nltk-develop | nltk-develop/nltk/chunk/named_entity.py | # Natural Language Toolkit: Chunk parsing API
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Named entity chunker
"""
import os
import pickle
import re
from xml.etree import ElementTree as ET
from nltk.... | 10,788 | 29.563739 | 87 | py |
nltk-develop | nltk-develop/nltk/chunk/util.py | # Natural Language Toolkit: Chunk format conversions
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from nltk.metrics import accuracy... | 20,668 | 31.09472 | 110 | py |
nltk-develop | nltk-develop/nltk/chunk/__init__.py | # Natural Language Toolkit: Chunkers
#
# 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
#
"""
Classes and interfaces for identifying non-overlapping linguistic
groups... | 7,400 | 36.378788 | 83 | py |
nltk-develop | nltk-develop/nltk/stem/rslp.py | # Natural Language Toolkit: RSLP Stemmer
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Tiago Tresoldi <tresoldi@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# This code is based on the algorithm presented in the paper "A Stemming
# Algorithm for the Portuguese Language" by ... | 5,355 | 37.811594 | 83 | py |
nltk-develop | nltk-develop/nltk/stem/lancaster.py | # Natural Language Toolkit: Stemmers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Tomcavage <stomcava@law.upenn.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A word stemmer based on the Lancaster (Paice/Husk) stemming algorithm.
Paice, Chris D. "Another Stemmer." ACM S... | 12,244 | 34.59593 | 93 | py |
nltk-develop | nltk-develop/nltk/stem/snowball.py | #
# Natural Language Toolkit: Snowball Stemmer
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Peter Michael Stahl <pemistahl@gmail.com>
# Peter Ljunglof <peter.ljunglof@heatherleaf.se> (revisions)
# Lakhdar Benzahia <lakhdar.benzahia@gmail.com> (co-writer)
# Assem Chelli <assem.ch@gmail.com... | 177,604 | 28.864638 | 112 | py |
nltk-develop | nltk-develop/nltk/stem/arlstem.py | #
# Natural Language Toolkit: ARLSTem Stemmer
#
# Copyright (C) 2001-2023 NLTK Project
#
# Author: Kheireddine Abainia (x-programer) <k.abainia@gmail.com>
# Algorithms: Kheireddine Abainia <k.abainia@gmail.com>
# Siham Ouamour
# Halim Sayoud
# URL: <https://www.nltk.org/>... | 12,645 | 33.933702 | 86 | py |
nltk-develop | nltk-develop/nltk/stem/isri.py | #
# Natural Language Toolkit: The ISRI Arabic Stemmer
#
# Copyright (C) 2001-2023 NLTK Project
# Algorithm: Kazem Taghva, Rania Elkhoury, and Jeffrey Coombs (2005)
# Author: Hosam Algasaier <hosam_hme@yahoo.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
ISRI Arabic Stemmer
The algo... | 14,345 | 35.227273 | 100 | py |
nltk-develop | nltk-develop/nltk/stem/regexp.py | # Natural Language Toolkit: Stemmers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import re
from nltk.stem.api import... | 1,522 | 25.719298 | 69 | py |
nltk-develop | nltk-develop/nltk/stem/api.py | # Natural Language Toolkit: Stemmer Interface
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from abc import ABCMeta, a... | 714 | 24.535714 | 66 | py |
nltk-develop | nltk-develop/nltk/stem/cistem.py | # Natural Language Toolkit: CISTEM Stemmer for German
# Copyright (C) 2001-2023 NLTK Project
# Author: Leonie Weissweiler <l.weissweiler@outlook.de>
# Tom Aarsen <> (modifications)
# Algorithm: Leonie Weissweiler <l.weissweiler@outlook.de>
# Alexander Fraser <fraser@cis.lmu.de>
# URL: <https://www.nl... | 7,042 | 32.538095 | 97 | py |
nltk-develop | nltk-develop/nltk/stem/util.py | # Natural Language Toolkit: Stemmer Utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Helder <he7d3r@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
def suffix_replace(original, old, new):
"""
Replaces the old suffix of the original string by a new suffix
""... | 619 | 22.846154 | 66 | py |
nltk-develop | nltk-develop/nltk/stem/porter.py | """
Porter Stemmer
This is the Porter stemming algorithm. It follows the algorithm
presented in
Porter, M. "An algorithm for suffix stripping." Program 14.3 (1980): 130-137.
with some optional deviations that can be turned on or off with the
`mode` argument to the constructor.
Martin Porter, the algorithm's invento... | 27,657 | 37.628492 | 85 | py |
nltk-develop | nltk-develop/nltk/stem/__init__.py | # Natural Language Toolkit: Stemmers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
NLTK Stemmers
Interfaces used ... | 1,262 | 35.085714 | 70 | py |
nltk-develop | nltk-develop/nltk/stem/arlstem2.py | #
# Natural Language Toolkit: ARLSTem Stemmer v2
#
# Copyright (C) 2001-2023 NLTK Project
#
# Author: Kheireddine Abainia (x-programer) <k.abainia@gmail.com>
# Algorithms: Kheireddine Abainia <k.abainia@gmail.com>
# Hamza Rebbani <hamrebbani@gmail.com>
# URL: <https://www.nltk.org/>
# For licens... | 16,071 | 34.091703 | 86 | py |
nltk-develop | nltk-develop/nltk/stem/wordnet.py | # Natural Language Toolkit: WordNet stemmer interface
#
# 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 import wordnet as wn
class WordNetLemmatiz... | 1,606 | 31.14 | 78 | py |
nltk-develop | nltk-develop/nltk/draw/tree.py | # Natural Language Toolkit: Graphical Representations for Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Graphically display a Tree.
"""
from tkinter import IntVar, Menu, Tk
from nltk.draw.util im... | 38,146 | 32.758407 | 88 | py |
nltk-develop | nltk-develop/nltk/draw/table.py | # Natural Language Toolkit: Table widget
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Tkinter widgets for displaying multi-column listboxes and tables.
"""
import operator
from tkinter import Frame, La... | 45,085 | 37.273345 | 118 | py |
nltk-develop | nltk-develop/nltk/draw/cfg.py | # Natural Language Toolkit: CFG visualization
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Visualization tools for CFGs.
"""
# Idea for a nice demo:
# - 3 panes: grammar, treelet, working area
# ... | 29,935 | 33.809302 | 88 | py |
nltk-develop | nltk-develop/nltk/draw/dispersion.py | # Natural Language Toolkit: Dispersion Plots
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A utility for displaying lexical dispersion.
"""
def dispersion_plot(text, words, ignore_case=False, title=... | 1,816 | 26.530303 | 85 | py |
nltk-develop | nltk-develop/nltk/draw/util.py | # Natural Language Toolkit: Drawing utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Tools for graphically displaying and interacting with the objects and
processing classes defined by the Toolkit... | 88,369 | 33.305124 | 88 | py |
nltk-develop | nltk-develop/nltk/draw/__init__.py | # Natural Language Toolkit: graphical representations package
#
# 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
# Import Tkinter-based modules if Tkinter is installe... | 783 | 27 | 83 | py |
nltk-develop | nltk-develop/nltk/tbl/erroranalysis.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
# re... | 1,416 | 35.333333 | 84 | py |
nltk-develop | nltk-develop/nltk/tbl/rule.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from... | 11,193 | 33.656347 | 95 | py |
nltk-develop | nltk-develop/nltk/tbl/template.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
impo... | 12,567 | 37.552147 | 139 | py |
nltk-develop | nltk-develop/nltk/tbl/api.py | 0 | 0 | 0 | py | |
nltk-develop | nltk-develop/nltk/tbl/demo.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
impo... | 14,920 | 34.610979 | 119 | py |
nltk-develop | nltk-develop/nltk/tbl/__init__.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
... | 759 | 22.75 | 60 | py |
nltk-develop | nltk-develop/nltk/tbl/feature.py | # Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from... | 9,423 | 34.164179 | 102 | py |
nltk-develop | nltk-develop/nltk/classify/svm.py | # Natural Language Toolkit: SVM-based classifier
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Leon Derczynski <leon@dcs.shef.ac.uk>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
nltk.classify.svm was deprecated. For classification based
on support vector machines SVMs use nltk.cl... | 508 | 27.277778 | 61 | py |
nltk-develop | nltk-develop/nltk/classify/megam.py | # Natural Language Toolkit: Interface to Megam Classifier
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A set of functions used to interface with the external megam_ maxent
optimization package. Before m... | 6,212 | 32.583784 | 99 | py |
nltk-develop | nltk-develop/nltk/classify/textcat.py | # Natural Language Toolkit: Language ID module using TextCat algorithm
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Avital Pekker <avital.pekker@utoronto.ca>
#
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A module for language identification using the TextCat algorithm.
An implem... | 5,838 | 28.489899 | 82 | py |
nltk-develop | nltk-develop/nltk/classify/weka.py | # Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classifiers that make use of the external 'Weka' package.
"""
import os
import re
import subproce... | 12,561 | 32.232804 | 88 | py |
nltk-develop | nltk-develop/nltk/classify/tadm.py | # Natural Language Toolkit: Interface to TADM Classifier
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Joseph Frazee <jfrazee@mail.utexas.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import subprocess
import sys
from nltk.internals import find_binary
try:
import numpy
excep... | 3,433 | 26.918699 | 87 | py |
nltk-develop | nltk-develop/nltk/classify/api.py | # Natural Language Toolkit: Classifier Interface
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Interfaces for labeling tokens with category... | 6,430 | 31.811224 | 81 | py |
nltk-develop | nltk-develop/nltk/classify/decisiontree.py | # Natural Language Toolkit: Decision Tree Classifiers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier model that decides which label to assign to a token on
the basis of a tree structure, wher... | 12,734 | 35.385714 | 88 | py |
nltk-develop | nltk-develop/nltk/classify/rte_classify.py | # Natural Language Toolkit: RTE Classifier
#
# 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
"""
Simple classifier for RTE corpus.
It calculates the overlap in words and named entities between text and
hypothesis... | 6,118 | 32.255435 | 84 | py |
nltk-develop | nltk-develop/nltk/classify/util.py | # Natural Language Toolkit: Classifier Utility Functions
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions and classes for cl... | 12,115 | 33.916427 | 86 | py |
nltk-develop | nltk-develop/nltk/classify/positivenaivebayes.py | # Natural Language Toolkit: Positive Naive Bayes Classifier
#
# Copyright (C) 2012 NLTK Project
# Author: Alessandro Presta <alessandro.presta@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A variant of the Naive Bayes Classifier that performs binary classification with
partia... | 7,232 | 38.961326 | 90 | py |
nltk-develop | nltk-develop/nltk/classify/naivebayes.py | # Natural Language Toolkit: Naive Bayes Classifiers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier based on the Naive Bayes algorithm. In order to find the
probability for a label, this algo... | 10,453 | 39.05364 | 80 | py |
nltk-develop | nltk-develop/nltk/classify/maxent.py | # Natural Language Toolkit: Maximum Entropy Classifiers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Dmitry Chichkov <dchichkov@gmail.com> (TypedMaxentFeatureEncoding)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier model based... | 59,352 | 36.804459 | 88 | py |
nltk-develop | nltk-develop/nltk/classify/senna.py | # Natural Language Toolkit: Senna Interface
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Rami Al-Rfou' <ralrfou@cs.stonybrook.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A general interface to the SENNA pipeline that supports any of the
operations specified in SUPPORTED_OPE... | 6,755 | 37.169492 | 113 | py |
nltk-develop | nltk-develop/nltk/classify/__init__.py | # Natural Language Toolkit: Classifiers
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classes and interfaces for labeling tokens with category labels (or
"class labels"). Typically, labels are represent... | 4,495 | 43.078431 | 88 | py |
nltk-develop | nltk-develop/nltk/classify/scikitlearn.py | # Natural Language Toolkit: Interface to scikit-learn classifiers
#
# Author: Lars Buitinck <L.J.Buitinck@uva.nl>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
scikit-learn (https://scikit-learn.org) is a machine learning library for
Python. It supports many classification algorithms, in... | 5,405 | 36.541667 | 81 | py |
nltk-develop | nltk-develop/nltk/tree/immutable.py | # Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Tom Aarsen <>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from... | 4,053 | 31.432 | 88 | py |
nltk-develop | nltk-develop/nltk/tree/probabilistic.py | # Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Tom Aarsen <>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
fro... | 2,417 | 31.24 | 70 | py |
nltk-develop | nltk-develop/nltk/tree/tree.py | # Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Nathan Bodenstab <bodenstab@cslu.ogi.edu> (tree transforms)
# Eric Kafe <kafe.eric@gm... | 35,517 | 35.132248 | 121 | py |
nltk-develop | nltk-develop/nltk/tree/prettyprinter.py | # Natural Language Toolkit: ASCII visualization of NLTK trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Andreas van Cranenburgh <A.W.vanCranenburgh@uva.nl>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Pretty-printing of discontin... | 24,958 | 38.743631 | 88 | py |
nltk-develop | nltk-develop/nltk/tree/parented.py | # Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Tom Aarsen <>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
impo... | 22,601 | 37.243655 | 110 | py |
nltk-develop | nltk-develop/nltk/tree/parsing.py | # Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Tom Aarsen <>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
impo... | 2,016 | 29.104478 | 100 | py |
nltk-develop | nltk-develop/nltk/tree/__init__.py | # Natural Language Toolkit: Machine Translation
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Tom Aarsen <>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.... | 1,413 | 25.679245 | 63 | py |
nltk-develop | nltk-develop/nltk/tree/transforms.py | # Natural Language Toolkit: Tree Transformations
#
# Copyright (C) 2005-2007 Oregon Graduate Institute
# Author: Nathan Bodenstab <bodenstab@cslu.ogi.edu>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
r"""
A collection of methods for tree (grammar) transformations used
in parsing natural la... | 13,351 | 38.386431 | 102 | py |
nltk-develop | nltk-develop/nltk/sem/glue.py | # Natural Language Toolkit: Glue Semantics
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import os
from itertools import chain
import nltk
from nltk.internals import Counter
from nltk.sem import drt, l... | 29,419 | 34.191388 | 105 | py |
nltk-develop | nltk-develop/nltk/sem/evaluate.py | # Natural Language Toolkit: Models for first-order languages with lambda
#
# 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
# TODO:
# - fix tracing
# - fix iterator-based approach to existentials
"""
This module p... | 25,453 | 29.66747 | 108 | py |
nltk-develop | nltk-develop/nltk/sem/skolemize.py | # Natural Language Toolkit: Semantic Interpretation
#
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.sem.logic import (
AllExpression,
AndExpression,
ApplicationExpression,
EqualityExp... | 5,722 | 37.409396 | 88 | py |
nltk-develop | nltk-develop/nltk/sem/chat80.py | # Natural Language Toolkit: Chat-80 KB Reader
# See https://www.w3.org/TR/swbp-skos-core-guide/
#
# 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
r"""
Overview
========
Chat-80 was a natural language system which... | 25,662 | 28.910256 | 86 | py |
nltk-develop | nltk-develop/nltk/sem/drt.py | # Natural Language Toolkit: Discourse Representation Theory (DRT)
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import operator
from functools import reduce
from itertools import chain
from nltk.sem.lo... | 51,689 | 34.379877 | 110 | py |
nltk-develop | nltk-develop/nltk/sem/linearlogic.py | # Natural Language Toolkit: Linear Logic
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.internals import Counter
from nltk.sem.logic import APP, LogicParser
_counter = Counter()
class Tokens... | 16,752 | 33.6853 | 123 | py |
nltk-develop | nltk-develop/nltk/sem/hole.py | # Natural Language Toolkit: Logic
#
# Author: Peter Wang
# Updated by: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
An implementation of the Hole Semantics model, following Blackburn and Bos,
Representatio... | 13,821 | 33.90404 | 89 | py |
nltk-develop | nltk-develop/nltk/sem/drt_glue_demo.py | # Natural Language Toolkit: GUI Demo for Glue Semantics with Discourse
# Representation Theory (DRT) as meaning language
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
try:
... | 18,618 | 32.608303 | 107 | py |
nltk-develop | nltk-develop/nltk/sem/lfg.py | # Natural Language Toolkit: Lexical Functional Grammar
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
from itertools import chain
from nltk.internals import Counter
class FStructure(dict):
def saf... | 7,455 | 27.458015 | 87 | py |
nltk-develop | nltk-develop/nltk/sem/util.py | # Natural Language Toolkit: Semantic Interpretation
#
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions for batch-processing sentences: parsing and
extraction of the semantic representation o... | 8,753 | 27.23871 | 117 | py |
nltk-develop | nltk-develop/nltk/sem/__init__.py | # Natural Language Toolkit: Semantic Interpretation
#
# 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
"""
NLTK Semantic Interpretation Package
This package contains classes for representing semantic structure in
... | 2,368 | 30.171053 | 83 | py |
nltk-develop | nltk-develop/nltk/sem/cooper_storage.py | # Natural Language Toolkit: Cooper storage for Quantifier Ambiguity
#
# 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
from nltk.parse import load_parser
from nltk.parse.featurechart import InstantiateVarsChart
fro... | 4,086 | 31.696 | 83 | py |
nltk-develop | nltk-develop/nltk/sem/boxer.py | # Natural Language Toolkit: Interface to Boxer
# <http://svn.ask.it.usyd.edu.au/trac/candc/wiki/boxer>
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
An interface to Boxer.
This interface relies on ... | 53,682 | 32.426526 | 108 | py |
nltk-develop | nltk-develop/nltk/sem/logic.py | # Natural Language Toolkit: Logic
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2023 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A version of first order predicate logic, built on
top of the typed lambda calculus.
"""
import operator
import re
fr... | 68,174 | 31.998548 | 90 | py |
nltk-develop | nltk-develop/nltk/sem/relextract.py | # Natural Language Toolkit: Relation Extraction
#
# 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
"""
Code for extracting relational triples from the ieer and conll2002 corpora.
Relations are stored internally as... | 15,270 | 27.27963 | 146 | py |
nltk-develop | nltk-develop/nltk/test/conftest.py | import pytest
from nltk.corpus.reader import CorpusReader
@pytest.fixture(autouse=True)
def mock_plot(mocker):
"""Disable matplotlib plotting in test code"""
try:
import matplotlib.pyplot as plt
mocker.patch.object(plt, "gca")
mocker.patch.object(plt, "show")
except ImportError:... | 771 | 21.705882 | 69 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.