Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
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
simulation
OpenCCG
Commits
f55783e3
Commit
f55783e3
authored
10 years ago
by
Michael White
Browse files
Options
Downloads
Patches
Plain Diff
Updated to use a supertagger stand-in for lex lookup with the required supertag.
parent
2321e483
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/opennlp/ccgbank/extract/Testbed.java
+29
-5
29 additions, 5 deletions
src/opennlp/ccgbank/extract/Testbed.java
with
29 additions
and
5 deletions
src/opennlp/ccgbank/extract/Testbed.java
+
29
−
5
View file @
f55783e3
...
...
@@ -28,7 +28,6 @@ import opennlp.ccgbank.CCGBankTaskTestbed;
import
opennlp.ccg.grammar.Grammar
;
import
opennlp.ccg.grammar.RuleGroup
;
import
opennlp.ccg.hylo.*
;
import
opennlp.ccg.lexicon.*
;
import
opennlp.ccg.parse.ParseException
;
import
opennlp.ccg.synsem.*
;
...
...
@@ -52,6 +51,9 @@ public class Testbed {
private
Lexicon
lexicon
;
private
RuleGroup
rules
;
// supertagger stand-in
private
SupertaggerStandIn
supertaggerStandIn
=
new
SupertaggerStandIn
();
// results of following deriv
private
Sign
sign
=
null
;
...
...
@@ -529,12 +531,15 @@ public class Testbed {
// nb: for now, need to ignore rel for non-VB pos
if
(!
pos
.
startsWith
(
"VB"
))
rel
=
null
;
// lex lookup with required supertag
lexicon
.
setSupertagger
(
supertaggerStandIn
);
supertaggerStandIn
.
setTag
(
simpleCat
);
SignHash
lexSigns
=
lexicon
.
getSignsFromWord
(
w
);
if
(
semClass
==
null
||
semClass
.
length
()
==
0
)
semClass
=
"NoClass"
;
// add lex signs, filtered by
supercat and
rel, reindexed
// add lex signs, filtered by rel, reindexed
// also check number with matching pos, match on no class
int
matchPOS
=
0
;
boolean
matchNoClass
=
false
;
...
...
@@ -547,16 +552,13 @@ public class Testbed {
morphClass
=
"NoClass"
;
Category
lexcat
=
s
.
getCategory
();
String
supertag
=
lexcat
.
getSupertag
();
LF
lexLF
=
lexcat
.
getLF
();
// allow any class if no sem class given
if
(!(
semClass
.
equals
(
"NoClass"
)
||
semClass
.
equals
(
morphClass
))
||
!
simpleCat
.
equals
(
supertag
)
||
!
containsPred
(
lexLF
,
rel
)
||
!
containsRoles
(
lexLF
,
roles
)
||
!
containsRel
(
lexLF
,
indexRel
,
s
))
{
//System.out.println("Mismatch: simpleCat is " + simpleCat + ", supertag is " + supertag);
it
.
remove
();
}
else
{
...
...
@@ -873,4 +875,26 @@ public class Testbed {
// escapes a string using DefaultTokenizer
private
static
String
escape
(
String
s
)
{
return
DefaultTokenizer
.
escape
(
s
);
}
// stands in for a supertagger during lex lookup
private
static
class
SupertaggerStandIn
implements
SupertaggerAdapter
{
// map for a single key
private
Map
<
String
,
Double
>
map
=
new
HashMap
<
String
,
Double
>(
2
);
public
Map
<
String
,
Double
>
getSupertags
()
{
return
map
;
}
// set tag
void
setTag
(
String
tag
)
{
map
.
clear
();
map
.
put
(
tag
,
1.0
);
}
// dummy implementations
public
void
setIncludeGold
(
boolean
includeGold
)
{}
public
void
resetBeta
()
{}
public
void
resetBetaToMax
()
{}
public
void
nextBeta
()
{}
public
void
previousBeta
()
{}
public
boolean
hasMoreBetas
()
{
return
false
;
}
public
boolean
hasLessBetas
()
{
return
false
;
}
public
double
[]
getBetas
()
{
return
new
double
[]{
1.0
};
}
public
void
setBetas
(
double
[]
betas
)
{}
public
double
getCurrentBetaValue
()
{
return
1.0
;
}
}
}
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