Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web-openccg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ease-ph
DeepLanguageUnderstanding
web-openccg
Commits
78171113
Unverified
Commit
78171113
authored
6 years ago
by
Sebastian Höffner
Browse files
Options
Downloads
Patches
Plain Diff
Integrating the ccgparser method into the wccg module.
parent
b55f97fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/ccgparser.py
+0
-17
0 additions, 17 deletions
app/ccgparser.py
app/wccg.py
+17
-1
17 additions, 1 deletion
app/wccg.py
tests/test_wccg.py
+2
-2
2 additions, 2 deletions
tests/test_wccg.py
with
19 additions
and
20 deletions
app/ccgparser.py
deleted
100644 → 0
+
0
−
17
View file @
b55f97fd
from
tatsu.util
import
asjson
from
tatsu.model
import
ModelBuilderSemantics
from
generated_openccg_parser
import
OpenCCGParser
def
ccg_to_json
(
to_parse
):
"""
Parses an OpenCCG string into a more easily digestiable JSON format.
Args:
to_parse: The OpenCCG string.
Returns:
A JSON representation of the OpenCCG string.
"""
return
asjson
(
OpenCCGParser
().
parse
(
to_parse
,
semantics
=
ModelBuilderSemantics
(),
parseinfo
=
False
))
This diff is collapsed.
Click to expand it.
app/wccg.py
+
17
−
1
View file @
78171113
...
...
@@ -3,7 +3,10 @@ import re
import
string
import
subprocess
from
ccgparser
import
ccg_to_json
from
tatsu.util
import
asjson
from
tatsu.model
import
ModelBuilderSemantics
from
generated_openccg_parser
import
OpenCCGParser
def
parse
(
sentence
):
...
...
@@ -117,3 +120,16 @@ def jsonify_parses(wccg_response):
copy
=
wccg_response
.
copy
()
copy
[
'
json_parses
'
]
=
json_parses
return
copy
def
ccg_to_json
(
to_parse
):
"""
Parses an OpenCCG string into a more easily digestiable JSON format.
Args:
to_parse: The OpenCCG string.
Returns:
A JSON representation of the OpenCCG string.
"""
return
asjson
(
OpenCCGParser
().
parse
(
to_parse
,
semantics
=
ModelBuilderSemantics
(),
parseinfo
=
False
))
This diff is collapsed.
Click to expand it.
tests/test_ccg
parser
.py
→
tests/test_
w
ccg.py
+
2
−
2
View file @
78171113
...
...
@@ -9,7 +9,7 @@ import os
os
.
sys
.
path
.
append
(
Path
(
__file__
).
parent
/
'
..
'
/
'
app
'
)
import
ccg
parser
# noqa
import
w
ccg
# noqa
class
CCGtoJSONTestCase
(
unittest
.
TestCase
):
...
...
@@ -28,4 +28,4 @@ class CCGtoJSONTestCase(unittest.TestCase):
ccg
=
test_case
[
'
ccg
'
]
expected
=
test_case
[
'
json
'
]
self
.
assertEqual
(
expected
,
ccg
parser
.
ccg_to_json
(
ccg
))
self
.
assertEqual
(
expected
,
w
ccg
.
ccg_to_json
(
ccg
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment