Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
c92ad382
Commit
c92ad382
authored
Oct 27, 2014
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed AbstractDrs to DrtExpression (a renaming for 3.0 that was not completely implemented)
parent
42e3974d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
nltk/sem/boxer.py
+7
-7
nltk/sem/glue.py
+1
-1
No files found.
nltk/sem/boxer.py
View file @
c92ad382
...
...
@@ -81,7 +81,7 @@ class Boxer(object):
:param input: str Input sentence to parse
:param occur_index: bool Should predicates be occurrence indexed?
:param discourse_id: str An identifier to be inserted to each occurrence-indexed predicate.
:return: ``drt.
AbstractDrs
``
:return: ``drt.
DrtExpression
``
"""
discourse_ids
=
([
discourse_id
]
if
discourse_id
is
not
None
else
None
)
d
,
=
self
.
interpret_multi_sents
([[
input
]],
discourse_ids
,
question
,
verbose
)
...
...
@@ -96,7 +96,7 @@ class Boxer(object):
:param input: list of str Input sentences to parse as a single discourse
:param occur_index: bool Should predicates be occurrence indexed?
:param discourse_id: str An identifier to be inserted to each occurrence-indexed predicate.
:return: ``drt.
AbstractDrs
``
:return: ``drt.
DrtExpression
``
"""
discourse_ids
=
([
discourse_id
]
if
discourse_id
is
not
None
else
None
)
d
,
=
self
.
interpret_multi_sents
([
input
],
discourse_ids
,
question
,
verbose
)
...
...
@@ -111,7 +111,7 @@ class Boxer(object):
:param inputs: list of str Input sentences to parse as individual discourses
:param occur_index: bool Should predicates be occurrence indexed?
:param discourse_ids: list of str Identifiers to be inserted to each occurrence-indexed predicate.
:return: list of ``drt.
AbstractDrs
``
:return: list of ``drt.
DrtExpression
``
"""
return
self
.
interpret_multi_sents
([[
input
]
for
input
in
inputs
],
discourse_ids
,
question
,
verbose
)
...
...
@@ -122,7 +122,7 @@ class Boxer(object):
:param inputs: list of list of str Input discourses to parse
:param occur_index: bool Should predicates be occurrence indexed?
:param discourse_ids: list of str Identifiers to be inserted to each occurrence-indexed predicate.
:return: ``drt.
AbstractDrs
``
:return: ``drt.
DrtExpression
``
"""
if
discourse_ids
is
not
None
:
assert
len
(
inputs
)
==
len
(
discourse_ids
)
...
...
@@ -291,7 +291,7 @@ class BoxerOutputDrsParser(DrtParser):
"""
Parse a DRS condition
:return: list of ``
AbstractDrs
``
:return: list of ``
DrtExpression
``
"""
tok
=
self
.
token
()
accum
=
self
.
handle_condition
(
tok
,
indices
)
...
...
@@ -312,7 +312,7 @@ class BoxerOutputDrsParser(DrtParser):
Handle a DRS condition
:param indices: list of int
:return: list of ``
AbstractDrs
``
:return: list of ``
DrtExpression
``
"""
if
tok
==
'not'
:
return
[
self
.
_handle_not
()]
...
...
@@ -1148,7 +1148,7 @@ class NltkDrtBoxerDrsInterpreter(object):
def
interpret
(
self
,
ex
):
"""
:param ex: ``AbstractBoxerDrs``
:return: ``
AbstractDrs
``
:return: ``
DrtExpression
``
"""
if
isinstance
(
ex
,
BoxerDrs
):
drs
=
DRS
([
Variable
(
'x
%
d'
%
r
)
for
r
in
ex
.
refs
],
list
(
map
(
self
.
interpret
,
ex
.
conds
)))
...
...
nltk/sem/glue.py
View file @
c92ad382
...
...
@@ -580,7 +580,7 @@ class DrtGlueFormula(GlueFormula):
if
isinstance
(
meaning
,
string_types
):
self
.
meaning
=
drt
.
DrtExpression
.
fromstring
(
meaning
)
elif
isinstance
(
meaning
,
drt
.
AbstractDrs
):
elif
isinstance
(
meaning
,
drt
.
DrtExpression
):
self
.
meaning
=
meaning
else
:
raise
RuntimeError
(
'Meaning term neither string or expression:
%
s,
%
s'
%
(
meaning
,
meaning
.
__class__
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment