Commit 1ec1680f by Steven Bird

normalise whitespace

parent bc687466
......@@ -91,7 +91,7 @@ to format names is specified by `nltk.data.AUTO_FORMATS`:
.cfg -> cfg
.fcfg -> fcfg
.fol -> fol
.json -> json
.json -> json
.logic -> logic
.pcfg -> pcfg
.pickle -> pickle
......
......@@ -70,9 +70,9 @@ Test BindingDict
>>> all12.sort()
>>> print(all12)
['F: f', 'G: f', 'H: h']
>>> BindingDict([(F,f),(G,g),(H,h)]) == BindingDict({F:f, G:g, H:h})
True
>>> BindingDict([(F,f),(G,g),(H,h)]) == BindingDict({F:f, G:g, H:h})
True
>>> d4 = BindingDict({F: f})
>>> try: d4[F] = g
......@@ -87,37 +87,37 @@ Test Unify
Cannot unify f with g given {}
>>> f.unify(G, BindingDict()) == BindingDict({G: f})
True
True
>>> try: f.unify(G, BindingDict({G: h}))
... except UnificationException as e: print(e)
...
Cannot unify f with G given {G: h}
>>> f.unify(G, BindingDict({G: f})) == BindingDict({G: f})
True
True
>>> f.unify(G, BindingDict({H: f})) == BindingDict({G: f, H: f})
True
True
>>> G.unify(f, BindingDict()) == BindingDict({G: f})
True
True
>>> try: G.unify(f, BindingDict({G: h}))
... except UnificationException as e: print(e)
...
Cannot unify G with f given {G: h}
>>> G.unify(f, BindingDict({G: f})) == BindingDict({G: f})
True
True
>>> G.unify(f, BindingDict({H: f})) == BindingDict({G: f, H: f})
True
True
>>> G.unify(F, BindingDict()) == BindingDict({G: F})
True
True
>>> try: G.unify(F, BindingDict({G: H}))
... except UnificationException as e: print(e)
...
Cannot unify G with F given {G: H}
>>> G.unify(F, BindingDict({G: F})) == BindingDict({G: F})
True
True
>>> G.unify(F, BindingDict({H: F})) == BindingDict({G: F, H: F})
True
True
Test Compile
......
......@@ -425,43 +425,43 @@ Satisfier Tests
... g.purge()
... print("Satisfiers of '%s':\n\t%s" % (p, sorted(m.satisfiers(p, 'x', g))))
Satisfiers of 'boy(x)':
['b1', 'b2']
['b1', 'b2']
Satisfiers of '(x = x)':
['b1', 'b2', 'd1', 'g1', 'g2']
['b1', 'b2', 'd1', 'g1', 'g2']
Satisfiers of '(boy(x) | girl(x))':
['b1', 'b2', 'g1', 'g2']
['b1', 'b2', 'g1', 'g2']
Satisfiers of '(boy(x) & girl(x))':
[]
[]
Satisfiers of 'love(adam,x)':
['g1']
['g1']
Satisfiers of 'love(x,adam)':
['g1', 'g2']
['g1', 'g2']
Satisfiers of '-(x = adam)':
['b2', 'd1', 'g1', 'g2']
['b2', 'd1', 'g1', 'g2']
Satisfiers of 'exists z22.love(x,z22)':
['b1', 'b2', 'g1', 'g2']
['b1', 'b2', 'g1', 'g2']
Satisfiers of 'exists y.love(y,x)':
['b1', 'g1', 'g2']
['b1', 'g1', 'g2']
Satisfiers of 'all y.(girl(y) -> love(x,y))':
[]
[]
Satisfiers of 'all y.(girl(y) -> love(y,x))':
['b1']
['b1']
Satisfiers of 'all y.(girl(y) -> (boy(x) & love(y,x)))':
['b1']
['b1']
Satisfiers of '(boy(x) & all y.(girl(y) -> love(x,y)))':
[]
[]
Satisfiers of '(boy(x) & all y.(girl(y) -> love(y,x)))':
['b1']
['b1']
Satisfiers of '(boy(x) & exists y.(girl(y) & love(y,x)))':
['b1']
['b1']
Satisfiers of '(girl(x) -> dog(x))':
['b1', 'b2', 'd1']
['b1', 'b2', 'd1']
Satisfiers of 'all y.(dog(y) -> (x = y))':
['d1']
['d1']
Satisfiers of '-exists y.love(y,x)':
['b2', 'd1']
['b2', 'd1']
Satisfiers of 'exists y.(love(adam,y) & love(y,x))':
['b1']
['b1']
Tests based on the Blackburn & Bos testsuite
......
......@@ -20,33 +20,34 @@ a Synset with the highest number of overlapping words between the context
sentence and different definitions from each Synset.
>>> from nltk.wsd import lesk
>>> from nltk import word_tokenize
>>> sent = word_tokenize("I went to the bank to deposit money.")
>>> word = "bank"
>>> pos = "n"
>>> print(lesk(sent, word, pos))
Synset('depository_financial_institution.n.01')
>>> from nltk import word_tokenize
>>> sent = word_tokenize("I went to the bank to deposit money.")
>>> word = "bank"
>>> pos = "n"
>>> print(lesk(sent, word, pos))
Synset('depository_financial_institution.n.01')
The definitions for "bank" are:
>>> from nltk.corpus import wordnet as wn
>>> for ss in wn.synsets('bank'):
... print(ss, ss.definition())
Synset('bank.n.01') sloping land (especially the slope beside a body of water)
Synset('depository_financial_institution.n.01') a financial institution that accepts deposits and channels the money into lending activities
Synset('bank.n.03') a long ridge or pile
Synset('bank.n.04') an arrangement of similar objects in a row or in tiers
Synset('bank.n.05') a supply or stock held in reserve for future use (especially in emergencies)
Synset('bank.n.06') the funds held by a gambling house or the dealer in some gambling games
Synset('bank.n.07') a slope in the turn of a road or track; the outside is higher than the inside in order to reduce the effects of centrifugal force
Synset('savings_bank.n.02') a container (usually with a slot in the top) for keeping money at home
Synset('bank.n.09') a building in which the business of banking transacted
Synset('bank.n.10') a flight maneuver; aircraft tips laterally about its longitudinal axis (especially in turning)
Synset('bank.v.01') tip laterally
Synset('bank.v.02') enclose with a bank
Synset('bank.v.03') do business with a bank or keep an account at a bank
Synset('bank.v.04') act as the banker in a game or in gambling
Synset('bank.v.05') be in the banking business
Synset('deposit.v.02') put into a bank account
Synset('bank.v.07') cover with ashes so to control the rate of burning
Synset('trust.v.01') have confidence or faith in
>>> from nltk.corpus import wordnet as wn
>>> for ss in wn.synsets('bank'):
... print(ss, ss.definition())
...
Synset('bank.n.01') sloping land (especially the slope beside a body of water)
Synset('depository_financial_institution.n.01') a financial institution that accepts deposits and channels the money into lending activities
Synset('bank.n.03') a long ridge or pile
Synset('bank.n.04') an arrangement of similar objects in a row or in tiers
Synset('bank.n.05') a supply or stock held in reserve for future use (especially in emergencies)
Synset('bank.n.06') the funds held by a gambling house or the dealer in some gambling games
Synset('bank.n.07') a slope in the turn of a road or track; the outside is higher than the inside in order to reduce the effects of centrifugal force
Synset('savings_bank.n.02') a container (usually with a slot in the top) for keeping money at home
Synset('bank.n.09') a building in which the business of banking transacted
Synset('bank.n.10') a flight maneuver; aircraft tips laterally about its longitudinal axis (especially in turning)
Synset('bank.v.01') tip laterally
Synset('bank.v.02') enclose with a bank
Synset('bank.v.03') do business with a bank or keep an account at a bank
Synset('bank.v.04') act as the banker in a game or in gambling
Synset('bank.v.05') be in the banking business
Synset('deposit.v.02') put into a bank account
Synset('bank.v.07') cover with ashes so to control the rate of burning
Synset('trust.v.01') have confidence or faith in
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment