Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addresses bug where proc prop shows up without a process #992

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,29 @@ class SRLCompositionalGrounder(name: String, domainOntology: DomainOntology, w2v
val sortedSliced = groundings.sortBy(-_.score)
sortedSliced.take(topN.getOrElse(sortedSliced.length))
}

val returnedSRLGroundings = new ArrayBuffer[PredicateGrounding]
for (predGrounding <- srlGrounding) {
val tupleTheme = predGrounding.predicateTuple.theme
val tupleThemeProp = predGrounding.predicateTuple.themeProperties
val tupleProc = predGrounding.predicateTuple.themeProcess
val tupleProcProp = predGrounding.predicateTuple.themeProcessProperties
// move process property to theme property if process is empty AND no existing theme property
// THIS IS A HACK
if (tupleThemeProp.grounding.isEmpty && tupleProc.grounding.isEmpty && tupleProcProp.grounding.nonEmpty) {
val newTupleThemeProp = tupleProcProp
val newTupleProcProp = tupleProc
val newPredGrounding = PredicateGrounding(PredicateTuple(tupleTheme, newTupleThemeProp, tupleProc,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tupleTheme here could be empty, right? is that desired (i.e., not checking)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point...this would also give us the situation where we somehow have a theme property but no theme.

newTupleProcProp, Set[Int]()))
returnedSRLGroundings.append(newPredGrounding)
}
else {
returnedSRLGroundings.append(predGrounding)
}
}
// TODO: dig in and filter out duplicates in different parts of the predicate tuple
// e.g. when the same grounding is produced for THEME and PROCESS,
// skip to the next best PROCESS grounding
Seq(newOntologyGrounding(srlGrounding))
Seq(newOntologyGrounding(returnedSRLGroundings))
}

@tailrec
Expand Down