Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/logic.py | # Natural Language Toolkit: Logic
from nltk.utilities import Counter
from featurelite import SubstituteBindingsMixin, FeatureI
from featurelite import Variable as FeatureVariable
_counter = Counter()
def unique_variable(counter=None):
if counter is None: counter = _counter
unique = counter.get()
return Var... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/testw.py | from featurechart import *
from treeview import *
def demo():
cp = load_earley('lab3-slash.cfg', trace=1)
trees = cp.parse('Mary walks')
for tree in trees:
print tree
sem = tree[0].node['sem']
print sem
print sem.skolemise().clauses()
return sem.skolemise().clauses()... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/test.py | from featurechart import *
from treeview import *
def demo():
cp = load_earley('lab3-slash.cfg', trace=0)
trees = cp.parse('Mary sees a dog in Noosa')
for tree in trees:
print tree
sem = tree[0].node['sem']
print sem
print sem.skolemise().clauses()
return sem.skolemi... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/batchtest.py | from featurechart import *
from treeview import *
def demo():
cp = load_earley('gazdar6.cfg', trace=2)
cp.batch_test('all-gazdar-sentences.txt')
#run_profile()
if __name__ == '__main__': demo()
| 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/featurelite.py | """
This module provides utilities for treating Python dictionaries as X{feature
structures}. Specifically, it contains the C{unify} function, which can be used
to merge the properties of two dictionaries, and the C{Variable} class, which
holds an unknown value to be used in unification.
A X{feature structure} is a ma... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/category.py | # Natural Language Toolkit: Categories
#
# Copyright (C) 2001-2007 NLTK Project
# Author: Contributed by Rob Speer (NLTK version)
# Steven Bird <sb@csse.unimelb.edu.au> (NLTK-Lite Port)
# Ewan Klein <ewan@inf.ed.ac.uk> (Hooks for semantics)
# Peter Wang <wangp@csse.unimelb.edu.au> (Overhaul)
# U... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/starter.cfg | %start S
CP -> Comp S
CP -> CompWhNP S_WhNPGap
Comp ->
CompWhNP -> WhNP
S -> NP VP
S -> NP AUX VP
S -> AUX NP VP
S -> NPWhNP VP
S_WhNPGap -> NP VP_WhNPGap
S_WhNPGap -> NP AUX VP_WhNPGap
S_WhNPGap -> AUX NP VP_WhNPGap
AUX -> DOP
VP -> V0
VP -> V1 NP
VP -> V2 NP PPto
VP -> V3 CP
VP -> V4 AdjP
VP_WhNPGap -> V1 WhNPGap
VP_... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/gazdar5.cfg | %start Start
%kimmo "gazdar.kimmo.yaml"
Q -> DO[agr=?a] NP[-wh, agr=?a] AUX[+fin]/DO XP
Q -> DO[agr=?a] NP[-wh, agr=?a] AUX[+fin]/DO
Q -> BE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/BE XP
Q -> BE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/BE
Q -> HAVE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/HAVE
Q -> HAVE[agr=?a] NP[-wh, agr=?a] AUX[+fin]
... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/gazdar6.cfg | %start Start
%kimmo "gazdar.kimmo.yaml"
Q -> DO[agr=?a] NP[-wh, agr=?a] AUX[+fin]/DO XP
Q -> DO[agr=?a] NP[-wh, agr=?a] AUX[+fin]/DO
Q -> BE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/BE XP
Q -> BE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/BE
Q -> HAVE[agr=?a] NP[-wh, agr=?a] AUX[+fin]/HAVE
Q -> HAVE[agr=?a] NP[-wh, agr=?a] AUX[+fin]
... | 0 |
public_repos/nltk_contrib/nltk_contrib/mit/six863 | public_repos/nltk_contrib/nltk_contrib/mit/six863/semantics/__init__.py | # Natural Language Toolkit: Parsers
#
# Copyright (C) 2001-2007 NLTK Project
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Classes and interfaces for producing tree structures that re... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/decisiontree.py | # Natural Language Toolkit - Decision Tree
# Creates a Decision Tree Classifier
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import oner
class DecisionTree(... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/cfile.py | # Natural Language Toolkit - File
# Understands operations on files and the various input files extensions
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier.excep... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/instance.py | # Natural Language Toolkit - Instance
# Understands the various operations that can be preformed on an instance
# Each Instance inheriting from the main Instance is capable of operations
# it can logically perform on that instance value eg: Test instance can
# set the Class where as the Training instance ... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/attribute.py | # Natural Language Toolkit - Attribute
# can extract the name and values from a line and operate on them
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier.exceptio... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/instances.py | # Natural Language Toolkit - Instances
# Understands the creation and validation of instances from input file path
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifi... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/confusionmatrix.py | # Natural Language Toolkit - Confusion Matrix
# Updates itself with each classification result and constructs a matrix
# Using the matrix it is capable of calculating several performance figures
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distribu... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/commandline.py | # Natural Language Toolkit CommandLine
# understands the command line interaction
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from optparse import OptionParser
from nltk_contrib.classif... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/basicimports.py | from nltk_contrib.classifier.attribute import Attribute, Attributes
from nltk_contrib.classifier.confusionmatrix import ConfusionMatrix
from nltk_contrib.classifier.decisionstump import DecisionStump
from nltk_contrib.classifier.decisiontree import DecisionTree
from nltk_contrib.classifier.featureselect import FeatureS... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/zeror.py | # Natural Language Toolkit - ZeroR
# Capable of classifying the test or gold data using the ZeroR algorithm
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier impo... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/featureselect.py | # Natural Language Toolkit - Feature Select
# The command line entry point for feature selection
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import split_ign... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/decisionstump.py | # Natural Language Toolkit - Decision Stump
# Understands the procedure of creating a decision stump and
# calculating the number of errors
# Is generally created at the attribute level
# ie. each attribute will have a decision stump of its own
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
#... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/naivebayes.py | # Natural Language Toolkit - NaiveBayes
# Capable of classifying the test or gold data using Naive Bayes algorithm
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifi... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/classify.py | from nltk_contrib.classifier import commandline as cl
from nltk_contrib.classifier import oner, zeror, decisiontree, format, naivebayes, knn
import sys
a_help = "Selects the classification algorithm " \
+ "Options: 0R for Zero R, 1R for One R, DT for Decision" \
+ " Trees, NB for Naive... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/oner.py | # Natural Language Toolkit - OneR
# Capable of classifying the test or gold data using the OneR algorithm
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/numrange.py | # Natural Language Toolkit - Range
# Represents a range of numbers, not an immutable object and can be modified by include
# Capable of performing operations on ranges
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license i... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/util.py | # Natural Language Toolkit utilities used in classifier module, should be migrated to main utilities later
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
import UserList, math
class StatList(... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/discretise.py | # Natural Language Toolkit - Discretise
# The command line entry point to discretisers
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import split_ignore_space
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/discretisedattribute.py | # Natural Language Toolkit Discretized attribute
# Capable of mapping continuous values to discrete ones
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/format.py | from nltk_contrib.classifier import cfile, item, attribute as a, instance as ins, instances as inss
from nltk_contrib.classifier.exceptions import systemerror as se, filenotfounderror as fnf
class FormatI:
def __init__(self, name):
self.name = name
def metadata(self, file_path):
""... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/classifiers.txt | o===========================
Classifiers
===========================
# Package Structure
nltk
|
|--------> contrib
|
|-------> classifier <all python source code goes in here>
|
|-------> classifier_tests <all pyunit tests go in here>
# Building the Project
The project is built as a part of t... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/autoclass.py | # Natural Language Toolkit - AutoClass
# automatic class value generator
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
class AutoClass:
def __init__(self, name):
self.name = n... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/item.py | # Natural Language Toolkit - Item
# An item should be capable of operating on its string value
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
import re
class Item:
def __init__(self, ... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/knn.py | # Natural Language Toolkit - K nearest neighbour classifier
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import instances as ins, Classifier, distancemetric a... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/__init__.py | # Natural Language Toolkit
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier.exceptions import invaliddataerror as inv, illegalstateerror as ise
from nltk import pr... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/classifier/distancemetric.py | # Natural Language Toolkit - Distance Metric
# distance metrics to be used with different types of attributes
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
import math
def euclidean_dista... | 0 |
public_repos/nltk_contrib/nltk_contrib/classifier | public_repos/nltk_contrib/nltk_contrib/classifier/exceptions/invaliddataerror.py | # Natural Language Toolkit - InvalidDataError
# Is thrown when the input data entered by the user is invalid
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier.exc... | 0 |
public_repos/nltk_contrib/nltk_contrib/classifier | public_repos/nltk_contrib/nltk_contrib/classifier/exceptions/illegalstateerror.py | # Natural Language Toolkit - Illegal state error
# Is thrown to show indicate an illegal state in the program
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier.... | 0 |
public_repos/nltk_contrib/nltk_contrib/classifier | public_repos/nltk_contrib/nltk_contrib/classifier/exceptions/systemerror.py | # Natural Language Toolkit - System error
# Is thrown to show unusual behavior not caused by bad input from the user,
# but from a programming mistake.
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information s... | 0 |
public_repos/nltk_contrib/nltk_contrib/classifier | public_repos/nltk_contrib/nltk_contrib/classifier/exceptions/filenotfounderror.py | # Natural Language Toolkit - FileNotFound Error
# Is thrown when a file cannot be found at the path specified
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
import os
class FileNotFoundEr... | 0 |
public_repos/nltk_contrib/nltk_contrib/classifier | public_repos/nltk_contrib/nltk_contrib/classifier/exceptions/__init__.py | # Natural Language Toolkit
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://www.nltk.org/>
# This software is distributed under GPL, for license information see LICENSE.TXT
class SimpleError:
def __init__(self, message):
self.message = message
def __str__(self):
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/syllables_no.py | # -*- coding: utf-8 -*-
# Sets the encoding to utf-8 to avoid problems with æøå
import string
import re
import os
specialSyllables_no = """distribuert 4
lÊreinstitusjoner 7
spesielt 3
offisielle 5
arbeidssprÂk 3
utarbeidet 4
verdenserklÊringen 6
h¯yeste 3
tvinges 2
utvei 2
arbeide 3
samarbeid 3
verdenserklÊring 5
ov... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/textanalyzer.py | # -*- coding: utf-8 -*-
# Sets the encoding to utf-8 to avoid problems with æøå
import nltk.data
from nltk.tokenize import *
import syllables_en
import syllables_no
from languageclassifier import *
import logging
class textanalyzer(object):
tokenizer = RegexpTokenizer('(?u)\W+|\$[\d\.]+|\S+')
special_chars ... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/syllables_en.py | import string, re, os
###
### Fallback syllable counter
###
### This is based on the algorithm in Greg Fast's perl module
### Lingua::EN::Syllable.
###
specialSyllables_en = """tottered 2
chummed 1
peeped 1
moustaches 2
shamefully 3
messieurs 2
satiated 4
sailmaker 4
sheered 1
disinterred 3
propitiatory 6
bepatched 2... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/urlextracter.py | # -*- coding: utf-8 -*-
# Sets the encoding to utf-8 to avoid problems with æøå
import urllib
import htmlentitydefs
from sgmllib import *
import re
class URLextracter(SGMLParser):
style = False
script = False
hyperlink = False
linklist = []
def __init__(self, url='http://python.org'... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/crawler.py | # -*- coding: utf-8 -*-
# Sets the encoding to utf-8 to avoid problems with æøå
import random
import os,re
from urlextracter import *
from sgmllib import *
class Crawler:
current = ""
urls = []
crawled = []
def crawl(self,url):
self.current = url
print "Crawling " + url
t... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/readabilitytests.py | from textanalyzer import *
import math
class ReadabilityTool:
analyzedVars = {}
text = ""
lang = ""
tests_given_lang = {}
def __init__(self, text = ''):
self.tests_given_lang['all'] = {}
self.tests_given_lang['all']["ARI"] = self.ARI
self.tests_given_lang['all']['Fles... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/languageclassifier.py | # -*- coding: utf-8 -*-
# Sets the encoding to utf-8 to avoid problems with æøå
import glob
import re
import random
import math
import pickle
import os
import logging
from nltk.corpus import stopwords
from urlextracter import URLextracter
from sgmllib import *
class NaiveBayes(object):
p_word_given_lan... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/readability/__init__.py | """
UiA - (2007)
This is a project in the course IKT407-WebMining @ UiA
It is developed with intention to be a plugin to NLTK ( http://www.nltk.org )
Thomas Jakobsen - thomj05@student.uia.no
Thomas Skardal - thomas04@student.uia.no
"""
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/rte/logicentail.py | # Natural Language Toolkit: Recognizing Textual Entailment (RTE)
# using deep semantic entailment
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.corpus import rte
from nltk import wordnet
from nltk.stem.wor... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/align_regions.py |
# Based on Gale & Church 1993, "A Program for Aligning Sentences in Bilingual Corpora"
# This is a Python version of the C implementation by Mike Riley presented in the appendix
# of the paper. The documentation in the C program is retained where applicable.
import sys
from nltk.metrics import scores
import distanc... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/README.txt |
5/5/10
This directory contains 2 implementations of the Gale-Church alignment algorithm:
1. gale_church.py
2. align.py
api.py
align_util.py
distance_measures.py
This README concerns the second implementation which I am the author of
(ccrowner@gmail.com).
###############################... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/alignment_util.py |
# Utility Functions
def readlines(filename):
"""
Return an array of strings, one string for each line of the file
set len_ptr to the number of lines in the file.
@type filename: C{string}
@param filename:
@return: lines
@rtype: C{list}
@return: len_ptr
@rt... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/align_util.py |
# Natural Language Toolkit: Gale-Church Aligner Utilities
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Chris Crowner <ccrowner@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
# Utility Functions
def readlines(filename):
lines = []
input_file = file(filename, "r")
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/align.py |
# Natural Language Toolkit: Gale-Church Aligner
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Chris Crowner <ccrowner@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import sys
from itertools import izip
from nltk.metrics import scores
## --NLTK--
## Import the nltk.aligner modu... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/test.py |
import align_util
import align
import distance_measures
import sys
# import for madame_bovary_test()
from nltk.corpus.reader import plaintext, util
from nltk.text import Text
from nltk.data import *
from nltk.tokenize import *
import codecs
##//////////////////////////////////////////////////////
## Demonstration ... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/api.py | # Natural Language Toolkit: Aligner Interface
"""
Interfaces for aligning bitexts
L{AlignerI} is a standard interface for X{bilingual alignment}
"""
from nltk.internals import deprecated, overridden
from itertools import izip
##//////////////////////////////////////////////////////
# Alignment Interfaces
##////////... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/util.py | # Natural Language Toolkit: Aligner Utilities
#
# Copyright (C) 2001-2011 NLTK Project
# Author:
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/distance_measures.py |
# Natural Language Toolkit: Gale-Church Aligner Distance Functions
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Chris Crowner <ccrowner@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import math
BIG_DISTANCE = 2500
# Based on Gale & Church 1993, "A Program for Aligning Sentenc... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/gale_church.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Gale-Church Aligner
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Torsten Marek <marek@ifi.uzh.ch>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import division
import math
from util import *
# Based on Gale & Church 199... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/align/__init__.py | # Natural Language Toolkit: Aligners
#
# Copyright (C) 2001-2011 NLTK Project
# Author:
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Classes and interfaces for aligning text.
"""
from api import *
from gale_church import *
__all__ = []
| 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/bovaryfr.tok | Nous
étions
à
l’Étude
,
quand
le
Proviseur
entra
,
suivi
d’un
nouveau
habillé
en
bourgeois
et
d’un
garçon
de
classe
qui
portait
un
grand
pupitre.
.EOS
Ceux
qui
dormaient
se
réveillèrent
,
et
chacun
se
leva
comme
surpris
dans
son
travail.
.EOS
.EOP
Le
Proviseur
nous
fit
signe
de
nous
rasseoir
;
puis
,
se
tournant
vers
... | 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/chapter1_madame_bovary_fr.txt | PREMIÈRE PARTIE
I
Nous étions à l’Étude, quand le Proviseur entra, suivi d’un
nouveau habillé en bourgeois et d’un garçon de classe qui portait
un grand pupitre. Ceux qui dormaient se réveillèrent, et chacun se
leva comme surpris dans son travail.
Le Proviseur nous fit signe de nous rasseoir; puis, se tournant
ver... | 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/chapter1_madame_bovary_en.txt | MADAME BOVARY
Part I
Chapter One
We were in class when the head-master came in, followed by a "new
fellow," not wearing the school uniform, and a school servant carrying a
large desk. Those who had been asleep woke up, and every one rose as if
just surprised at his work.
The head-master made a sign to us to s... | 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/bovaryen.tok | We
were
in
class
when
the
head-master
came
in
,
followed
by
a
"
new
fellow
,
"
not
wearing
the
school
uniform
,
and
a
school
servant
carrying
a
large
desk.
.EOS
Those
who
had
been
asleep
woke
up
,
and
every
one
rose
as
if
just
surprised
at
his
work.
.EOS
.EOP
The
head-master
made
a
sign
to
us
to
sit
down.
.EOS
Then
,
t... | 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/ground_truth_bovary.txt | 0,0,0
0,1,1
1,0,0
1,1,0
2,0,0
2,1,1
3,0,0
3,1,1
3,2,2
3,3,3
3,4,4
4,0,0
4,1,1
5,0,0
6,0,0
6,1,1
6,2,2
6,3,3
7,0,0
| 0 |
public_repos/nltk_contrib/nltk_contrib/align | public_repos/nltk_contrib/nltk_contrib/align/data/ground_truth.txt | 0,0,0
1,0,0
2,0,0
3,0,0
4,0,0
4,1,1
4,2,2
5,0,0
6,0,0
7,0,0
7,1,1
7,2,2
8,0,0
9,0,0
10,0,0
11,0,0
12,0,0
12,1,1
12,2,2
12,3,3
13,0,0
13,1,1
13,2,2
13,3,3
14,0,0
14,1,1
14,2,2
14,3,3
14,4,4
14,5,5
15,0,0
16,0,0
16,1,1
16,2,2
17,0,0
17,1,1
17,2,2
18,0,0
19,0,0
20,0,0
20,1,1
21,0,0
22,0,0
23,0,0
24,0,0
25,0,0
25,1,1
26,0,... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/bioreader/bioreader.py | """
Classes to read and process MedLine XML record files, for use in processing modules.
They can handle the XML format used by PubMed and MedLine services, for example as returned by eutils online services
>>> xml_records = urllib.urlopen('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id='+li... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/bioreader/sample_pmids.txt | 10792463
9409145
9529892
10973069
88058940
10747919
15385551
11752325.
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/bioreader/__init__.py | # Natural Language Toolkit: Third-Party Contributions
#
# Contributions from: Carlos Rodriguez
#
# Copyright (C) 2001-2005 The original contributors
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
#
from bioreader import *
__all__ = [
'Reader',
'DataContainer',
'CreateXML']
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/utilities.py | # Natural Language Toolkit: Shoebox Utilities
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Stuart Robinson <stuart@zapata.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides basic functionality for handling shoebox format files.
These feed into the more sophisti... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/notes.txt | 1. Background
o-------------
The package nltk.contrib.shoebox contains functionality for manipulating Shoebox
files. These come in two types: settings files and database files. Database files are
either lexicon databases or text databases.
2. Levels
---------
The Shoebox functionality consists of three levels:
Level... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/settings.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Settings Parser
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Stuart Robinson <stuart@zapata.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides functionality for reading settings files for Toolbox.
Se... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/MDF-field-order.csv | \lx lexeme
\hm homonym number (subscripted)
\lc lexical citation
\ph phonetic [...] (only one for all languages)
\se subentry
\ps part of speech
\pn part of speech-national language
\sn sense number
\gv gloss-vernacular
\dv definition-vernacular
\ge gloss-English (supplanted by a \de)
\re reverse-English
\we word l... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/lexicon.py | # Natural Language Toolkit: Toolbox Lexicon
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Stuart Robinson <stuart@zapata.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This modules provides functionality for parsing and manipulating the
contents of a Toolbox lexicon without refe... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/iu_mien_hier.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox data file parser
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""Grammar for the Toolbox MDF Alternate Hierarchy."""
# this dictionary lists all... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/etreelib.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox data file parser
#
# Copyright (C) Frederick Lundh
# Author: Frederick Lundh
# URL: <http://effbot.org>
"""
module of utility functions for ElementTree structures. Many
are from U{http://effbot.org/zone/element-lib.htm}
"""
import nltk.etree.ElementTree as ... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/normalise.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox data file parser
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
functions to normalise ElementTree structures.
"""
import nltk.etree.ElementTr... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/language.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Settings Parser
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides functionality for reading language settings files for
Tool... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/data.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox data file parser
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""module for reading Toolbox data files
"""
from nltk.etree.ElementTree import El... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/text.py | # Natural Language Toolkit: Shoebox Text
#
# Author: Stuart Robinson <stuart@zapata.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides tools for parsing and manipulating the contents
of a Shoebox text without reference to its metadata.
"""
import re
from utilities i... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/__init__.py | # __all__ = ["data", "etreelib", "errors", "lexicon", "settings", "text", "utilities"]
from data import *
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/toolbox/errors.py | # Natural Language Toolkit: Shoebox Errors
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Stuart Robinson <Stuart.Robinson@mpi.nl>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
This module provides Shoebox exceptions.
"""
# -----------------------------------------------------------... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/demo2.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Data demonstration
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
corresponds to
12.3.1 Accessing Toolbox Data
in http://nltk.sourceforge.ne... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/mdfsamp_grammar | #Chunking Grammar for sample MDF database found in nltk_data/corpora/toolbox/MDF/MDFSampl.db.
paradigm: {<pd>?(<pdl><pdv>)?}
notes: {<ng|np|nt>+}
crossref: {<cf><ce><cn>?}
lexfunc: {<lf><lv><le>}
example: {<rf><xv><xe><xn>}
variant: {<va><ve>?<vn>?}
sense: {<sn>?<ge><de|gn|gr|re|rn... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/demo4.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Data demonstration
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
demonstration of grammar parsing
"""
from nltk.etree.ElementTree import Elem... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/analyse_toolbox.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Analyser
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org>
# For license information, see LICENSE.TXT
"""A tool for developing a chunking grammar to parse toolbox lexical databases
to run it:
... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/demo3.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Data demonstration
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
demonstration of grammar parsing
"""
from nltk.etree.ElementTree import Elem... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/mdf_alth_samp_grammar | #Chunking Grammar for sample MDF database found in nltk_data/corpora/toolbox/MDF/MDF_AltH.db
paradigm: {<pd>?(<pdl><pdv>)?}
notes: {<ng|np|nt>+}
crossref: {<cf><ce><cn>?}
lexfunc: {<lf><lv><le>}
example: {<rf><xv><xe><xn>}
variant: {<va><ve>?<vn>?}
pos: {<ps|pn>+}
subentry_sense:... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/demos/demo1.py | # -*- coding: utf-8 -*-
# Natural Language Toolkit: Toolbox Data demonstration
#
# Copyright (C) 2001-2006 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
corresponds to
12.3.1 Accessing Toolbox Data
in http://nltk.sourceforge.ne... | 0 |
public_repos/nltk_contrib/nltk_contrib/toolbox | public_repos/nltk_contrib/nltk_contrib/toolbox/test/toolbox_language.doctest | ===============================
Unit test cases for ``toolbox``
===============================
>>> from nltk_contrib.toolbox.language import Language
--------------------------
``Language``
--------------------------
>>> import nltk.data
>>> import os.path
>>> lang = Language(nltk.data.find('corpora/... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/typedterm.py | #
# type.py
#
# Edward Loper
# Created [12/10/00 01:58 PM]
# $Id$
#
"""CG-style types"""
import types
from term import *
#####################################
# TYPEDTERM
#####################################
class TypedTerm:
def __init__(self, term, type):
# Check types, because we're paranoid.
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/lambek.py | #
# lambek.py
#
# Edward Loper
# Created [12/10/00 03:41 AM]
# $Id$
#
"""Lambek Calculus Theorem Prover
"""
# For while I'm coding..
#import term;reload(term)
#import typedterm; reload(typedterm)
_VERBOSE = 0
_VAR_NAMES = 1
_SHOW_VARMAP = not _VAR_NAMES
from term import *
from typedterm import *
from lexicon impor... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/README | To run the lambek calculus theorem prover, type:
./lambek.py lexicon.txt
or:
python lambek.py lexicon.txt
For help, type "help" at the theorem prover prompt.
| 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/lexicon.py | #
# lexicon.py
#
# Edward Loper
# Created [12/10/00 11:51 PM]
# $Id$
#
"""Lexicon!
Files have lines of the form:
<word> : <lambda-term> : <type>
"""
from term import *
from typedterm import *
# Map from word to TypedTerm
class Lexicon:
def __init__(self):
self._map = {}
def load(self, file):
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/lambek.tex | %
% Ling 5554 Final Project: Lambek Calculus Theorem Prover
% Edward Loper
% Created [12/12/00 12:46 AM]
%
% $Id$
%
\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage{boxedminipage}
\begin{document}
\title{Lambek Calculus Theorem Prover}
\author{Edward Loper}
\date{\today}
\maketitle
\section{Introduct... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/lexicon.txt | # Lexicon for the Lambek calculus theorem prover.
#
# Created [12/11/00 02:52 AM]
#
# Words are normalized to lower case.
# Expressions and types are not.
#
# Format:
# <word> : <expr> : <type>
# Noun phrases
john: john: np
tom: tom: np
mary: mary: np
# Determiner
the: the: np/n
a: a: np/n
# Nouns
cat: cat: n
dog:... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/lambek/term.py | #
# term.py
#
# Edward Loper
# Created [12/10/00 01:58 PM]
# $Id$
#
"""Lambda calculus stuff"""
import types, re
from copy import deepcopy
class Term:
#FREEVAR_NAME = ['e', 'd', 'c', 'b', 'a']
FREEVAR_NAME = ['$\\epsilon$', '$\\delta$', '$\\gamma$', \
'$\\beta$', '$\\alpha$']
BOUNDVAR... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/fuf/fuf.py | import os
import nltk
from fufconvert import *
from link import *
from linearizer import *
from util import output_html, flatten
class GrammarPathResolver(object):
"""
C{GrammarPathResolver} analyses a given grammar and generates
the list of possible paths through the grammar by unpacking
all the po... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/fuf/link.py | """Module for resolving relative and absolute paths in FUF"""
import nltk
class LinkResolver(object):
"""
Object for resolving links
Note: links should not be resolved if 'alt' is present
in the feature structure.
"""
def __init__(self):
"""
Initialize and return the object.
... | 0 |
public_repos/nltk_contrib/nltk_contrib | public_repos/nltk_contrib/nltk_contrib/fuf/fufconvert.py | import re
import os
import nltk
from sexp import *
from link import *
from specialfs import *
from fstypes import *
def fuf_to_featstruct(fuf):
"""
Convert a FUF string into a FeatStruct. Note the string
must be a s-expression.
@param fuf: The fuf string
@type fuf: string
@return: C{nltk.feats... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.