{"action":"created","comment":{"url":"https://api.github.com/repos/Rahgooy/saul/pulls/comments/96422582","pull_request_review_id":17002658,"id":96422582,"diff_hunk":"@@ -0,0 +1,182 @@\n+package edu.illinois.cs.cogcomp.saulexamples.nlp.SpatialRoleLabeling\n+\n+import java.util.Properties\n+\n+import edu.illinois.cs.cogcomp.core.datastructures.ViewNames\n+import edu.illinois.cs.cogcomp.core.datastructures.textannotation.{Constituent, TextAnnotation, TokenLabelView, TreeView}\n+import edu.illinois.cs.cogcomp.core.datastructures._\n+import edu.illinois.cs.cogcomp.edison.features.FeatureUtilities\n+import edu.illinois.cs.cogcomp.edison.features.factory.{SubcategorizationFrame, WordFeatureExtractorFactory}\n+import edu.illinois.cs.cogcomp.edison.features.helpers.PathFeatureHelper\n+import edu.illinois.cs.cogcomp.nlp.common.PipelineConfigurator._\n+import edu.illinois.cs.cogcomp.nlp.utilities.CollinsHeadFinder\n+import edu.illinois.cs.cogcomp.saulexamples.nlp.BaseTypes._\n+import edu.illinois.cs.cogcomp.saulexamples.nlp.TextAnnotationFactory\n+\n+import scala.collection.JavaConverters._\n+import scala.collection.mutable\n+\n+/** Created by parisakordjamshidi on 12/25/16.\n+  */\n+object LanguageBaseTypeSensors {\n+  private val dependencyView = ViewNames.DEPENDENCY_STANFORD\n+  private val sentenceById = mutable.HashMap[String, TextAnnotation]()\n+  private val settings = new Properties()\n+  TextAnnotationFactory.disableSettings(settings, USE_SRL_NOM, USE_NER_ONTONOTES, USE_SRL_VERB)\n+  private val as = TextAnnotationFactory.createPipelineAnnotatorService(settings)\n+\n+  def documentToSentenceMatching(d: Document, s: Sentence): Boolean = {\n+    d.getId == s.getDocument.getId\n+  }\n+\n+  def sentenceToPhraseGenerating(s: Sentence): Seq[Phrase] = {\n+    getPhrases(s)\n+  }\n+\n+  def sentenceToPhraseMatching(s: Sentence, p: Phrase): Boolean = {\n+    s.getId == p.getSentence.getId\n+  }\n+\n+  def phraseToTokenGenerating(p: Phrase): Seq[Token] = {\n+    getTokens(p)\n+  }\n+\n+  def phraseToTokenMatching(p: Phrase, t: Token): Boolean = {\n+    p.getId == t.getPhrase.getId\n+  }\n+\n+  def sentenceToTokenGenerating(s: Sentence): Seq[Token] = {\n+    getTokens(s)\n+  }\n+\n+  def sentenceToTokenMatching(s: Sentence, t: Token): Boolean = {\n+    s.getId == t.getSentence.getId\n+  }\n+\n+  def getPos(e: NlpBaseElement): Seq[String] = {\n+    val constituents = getElementConstituents(e)\n+    constituents.map(x => WordFeatureExtractorFactory.pos.getFeatures(x).asScala.mkString)\n+  }\n+\n+  def getLemma(e: NlpBaseElement): Seq[String] = {\n+    val constituents = getElementConstituents(e)\n+    constituents.map(x => WordFeatureExtractorFactory.lemma.getFeatures(x).asScala.mkString)\n+  }\n+\n+  def getHeadword(p: Phrase): Token = {\n+    val ta = getTextAnnotation(p)\n+    val (startId: Int, endId: Int) = getTextAnnotationSpan(p)\n+    val phrase = ta.getView(ViewNames.SHALLOW_PARSE).getConstituentsCoveringSpan(startId, endId + 1).get(0)\n+\n+    val tree: TreeView = ta.getView(dependencyView).asInstanceOf[TreeView]\n+    val parsePhrase = tree.getParsePhrase(phrase)\n+    val headId = CollinsHeadFinder.getInstance.getHeadWordPosition(parsePhrase)\n+    val head = ta.getView(ViewNames.TOKENS).asInstanceOf[TokenLabelView].getConstituentAtToken(headId)\n+    new Token(p, p.getId + head.getSpan, head.getStartCharOffset, head.getEndCharOffset, head.toString)\n+  }\n+\n+  def getDependencyRelation(t: Token): String = {\n+    val relations = getDependencyRelations(getTextAnnotation(t))\n+    val root = getDependencyRoot(relations)\n+    if (root != null && root.getStartCharOffset == t.getStart)\n+      \"root\"\n+    else\n+      relations.find(r => r.getTarget.getStartCharOffset == t.getStart) match {\n+        case Some(r) => r.getRelationName\n+        case _ => \"\"\n+      }\n+  }\n+\n+  def getSemanticRole(e: NlpBaseElement): String = {\n+    val ta = getTextAnnotation(e)\n+    val view = if (ta.hasView(ViewNames.SRL_VERB)) {\n+      ta.getView(ViewNames.SRL_VERB)\n+    } else {\n+      null","path":"saul-examples/src/main/scala/edu/illinois/cs/cogcomp/saulexamples/nlp/SpatialRoleLabeling/LanguageBaseTypeSensors.scala","position":95,"original_position":95,"commit_id":"5455d74b9c5c86685005784dff93f4c8b8cdadda","original_commit_id":"5455d74b9c5c86685005784dff93f4c8b8cdadda","user":{"login":"kordjamshidi","id":5544447,"avatar_url":"https://avatars.githubusercontent.com/u/5544447?v=3","gravatar_id":"","url":"https://api.github.com/users/kordjamshidi","html_url":"https://github.com/kordjamshidi","followers_url":"https://api.github.com/users/kordjamshidi/followers","following_url":"https://api.github.com/users/kordjamshidi/following{/other_user}","gists_url":"https://api.github.com/users/kordjamshidi/gists{/gist_id}","starred_url":"https://api.github.com/users/kordjamshidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kordjamshidi/subscriptions","organizations_url":"https://api.github.com/users/kordjamshidi/orgs","repos_url":"https://api.github.com/users/kordjamshidi/repos","events_url":"https://api.github.com/users/kordjamshidi/events{/privacy}","received_events_url":"https://api.github.com/users/kordjamshidi/received_events","type":"User","site_admin":false},"body":"maybe some warning messages as well? ","created_at":"2017-01-17T14:32:20Z","updated_at":"2017-01-17T14:32:20Z","html_url":"https://github.com/Rahgooy/saul/pull/15#discussion_r96422582","pull_request_url":"https://api.github.com/repos/Rahgooy/saul/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/comments/96422582"},"html":{"href":"https://github.com/Rahgooy/saul/pull/15#discussion_r96422582"},"pull_request":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/Rahgooy/saul/pulls/15","id":101873019,"html_url":"https://github.com/Rahgooy/saul/pull/15","diff_url":"https://github.com/Rahgooy/saul/pull/15.diff","patch_url":"https://github.com/Rahgooy/saul/pull/15.patch","issue_url":"https://api.github.com/repos/Rahgooy/saul/issues/15","number":15,"state":"open","locked":false,"title":"spatialOntologyImplementation","user":{"login":"Rahgooy","id":5499744,"avatar_url":"https://avatars.githubusercontent.com/u/5499744?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahgooy","html_url":"https://github.com/Rahgooy","followers_url":"https://api.github.com/users/Rahgooy/followers","following_url":"https://api.github.com/users/Rahgooy/following{/other_user}","gists_url":"https://api.github.com/users/Rahgooy/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahgooy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahgooy/subscriptions","organizations_url":"https://api.github.com/users/Rahgooy/orgs","repos_url":"https://api.github.com/users/Rahgooy/repos","events_url":"https://api.github.com/users/Rahgooy/events{/privacy}","received_events_url":"https://api.github.com/users/Rahgooy/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-17T14:24:22Z","updated_at":"2017-01-17T14:32:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec99af29c7632ca0162334b1e375950b7b4c8e1a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Rahgooy/saul/pulls/15/commits","review_comments_url":"https://api.github.com/repos/Rahgooy/saul/pulls/15/comments","review_comment_url":"https://api.github.com/repos/Rahgooy/saul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Rahgooy/saul/issues/15/comments","statuses_url":"https://api.github.com/repos/Rahgooy/saul/statuses/5455d74b9c5c86685005784dff93f4c8b8cdadda","head":{"label":"Rahgooy:spatialOntologyImplementation","ref":"spatialOntologyImplementation","sha":"5455d74b9c5c86685005784dff93f4c8b8cdadda","user":{"login":"Rahgooy","id":5499744,"avatar_url":"https://avatars.githubusercontent.com/u/5499744?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahgooy","html_url":"https://github.com/Rahgooy","followers_url":"https://api.github.com/users/Rahgooy/followers","following_url":"https://api.github.com/users/Rahgooy/following{/other_user}","gists_url":"https://api.github.com/users/Rahgooy/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahgooy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahgooy/subscriptions","organizations_url":"https://api.github.com/users/Rahgooy/orgs","repos_url":"https://api.github.com/users/Rahgooy/repos","events_url":"https://api.github.com/users/Rahgooy/events{/privacy}","received_events_url":"https://api.github.com/users/Rahgooy/received_events","type":"User","site_admin":false},"repo":{"id":63954451,"name":"saul","full_name":"Rahgooy/saul","owner":{"login":"Rahgooy","id":5499744,"avatar_url":"https://avatars.githubusercontent.com/u/5499744?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahgooy","html_url":"https://github.com/Rahgooy","followers_url":"https://api.github.com/users/Rahgooy/followers","following_url":"https://api.github.com/users/Rahgooy/following{/other_user}","gists_url":"https://api.github.com/users/Rahgooy/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahgooy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahgooy/subscriptions","organizations_url":"https://api.github.com/users/Rahgooy/orgs","repos_url":"https://api.github.com/users/Rahgooy/repos","events_url":"https://api.github.com/users/Rahgooy/events{/privacy}","received_events_url":"https://api.github.com/users/Rahgooy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rahgooy/saul","description":"Saul : Declarative Learning-Based Programming","fork":true,"url":"https://api.github.com/repos/Rahgooy/saul","forks_url":"https://api.github.com/repos/Rahgooy/saul/forks","keys_url":"https://api.github.com/repos/Rahgooy/saul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rahgooy/saul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rahgooy/saul/teams","hooks_url":"https://api.github.com/repos/Rahgooy/saul/hooks","issue_events_url":"https://api.github.com/repos/Rahgooy/saul/issues/events{/number}","events_url":"https://api.github.com/repos/Rahgooy/saul/events","assignees_url":"https://api.github.com/repos/Rahgooy/saul/assignees{/user}","branches_url":"https://api.github.com/repos/Rahgooy/saul/branches{/branch}","tags_url":"https://api.github.com/repos/Rahgooy/saul/tags","blobs_url":"https://api.github.com/repos/Rahgooy/saul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rahgooy/saul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rahgooy/saul/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rahgooy/saul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rahgooy/saul/statuses/{sha}","languages_url":"https://api.github.com/repos/Rahgooy/saul/languages","stargazers_url":"https://api.github.com/repos/Rahgooy/saul/stargazers","contributors_url":"https://api.github.com/repos/Rahgooy/saul/contributors","subscribers_url":"https://api.github.com/repos/Rahgooy/saul/subscribers","subscription_url":"https://api.github.com/repos/Rahgooy/saul/subscription","commits_url":"https://api.github.com/repos/Rahgooy/saul/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rahgooy/saul/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rahgooy/saul/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rahgooy/saul/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rahgooy/saul/contents/{+path}","compare_url":"https://api.github.com/repos/Rahgooy/saul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rahgooy/saul/merges","archive_url":"https://api.github.com/repos/Rahgooy/saul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rahgooy/saul/downloads","issues_url":"https://api.github.com/repos/Rahgooy/saul/issues{/number}","pulls_url":"https://api.github.com/repos/Rahgooy/saul/pulls{/number}","milestones_url":"https://api.github.com/repos/Rahgooy/saul/milestones{/number}","notifications_url":"https://api.github.com/repos/Rahgooy/saul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rahgooy/saul/labels{/name}","releases_url":"https://api.github.com/repos/Rahgooy/saul/releases{/id}","deployments_url":"https://api.github.com/repos/Rahgooy/saul/deployments","created_at":"2016-07-22T13:13:12Z","updated_at":"2016-07-22T13:13:13Z","pushed_at":"2017-01-17T14:24:23Z","git_url":"git://github.com/Rahgooy/saul.git","ssh_url":"git@github.com:Rahgooy/saul.git","clone_url":"https://github.com/Rahgooy/saul.git","svn_url":"https://github.com/Rahgooy/saul","homepage":"","size":14435,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Rahgooy:master","ref":"master","sha":"abde3fd61f90cfa8b853e549255964fe79735a5b","user":{"login":"Rahgooy","id":5499744,"avatar_url":"https://avatars.githubusercontent.com/u/5499744?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahgooy","html_url":"https://github.com/Rahgooy","followers_url":"https://api.github.com/users/Rahgooy/followers","following_url":"https://api.github.com/users/Rahgooy/following{/other_user}","gists_url":"https://api.github.com/users/Rahgooy/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahgooy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahgooy/subscriptions","organizations_url":"https://api.github.com/users/Rahgooy/orgs","repos_url":"https://api.github.com/users/Rahgooy/repos","events_url":"https://api.github.com/users/Rahgooy/events{/privacy}","received_events_url":"https://api.github.com/users/Rahgooy/received_events","type":"User","site_admin":false},"repo":{"id":63954451,"name":"saul","full_name":"Rahgooy/saul","owner":{"login":"Rahgooy","id":5499744,"avatar_url":"https://avatars.githubusercontent.com/u/5499744?v=3","gravatar_id":"","url":"https://api.github.com/users/Rahgooy","html_url":"https://github.com/Rahgooy","followers_url":"https://api.github.com/users/Rahgooy/followers","following_url":"https://api.github.com/users/Rahgooy/following{/other_user}","gists_url":"https://api.github.com/users/Rahgooy/gists{/gist_id}","starred_url":"https://api.github.com/users/Rahgooy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rahgooy/subscriptions","organizations_url":"https://api.github.com/users/Rahgooy/orgs","repos_url":"https://api.github.com/users/Rahgooy/repos","events_url":"https://api.github.com/users/Rahgooy/events{/privacy}","received_events_url":"https://api.github.com/users/Rahgooy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rahgooy/saul","description":"Saul : Declarative Learning-Based Programming","fork":true,"url":"https://api.github.com/repos/Rahgooy/saul","forks_url":"https://api.github.com/repos/Rahgooy/saul/forks","keys_url":"https://api.github.com/repos/Rahgooy/saul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rahgooy/saul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rahgooy/saul/teams","hooks_url":"https://api.github.com/repos/Rahgooy/saul/hooks","issue_events_url":"https://api.github.com/repos/Rahgooy/saul/issues/events{/number}","events_url":"https://api.github.com/repos/Rahgooy/saul/events","assignees_url":"https://api.github.com/repos/Rahgooy/saul/assignees{/user}","branches_url":"https://api.github.com/repos/Rahgooy/saul/branches{/branch}","tags_url":"https://api.github.com/repos/Rahgooy/saul/tags","blobs_url":"https://api.github.com/repos/Rahgooy/saul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rahgooy/saul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rahgooy/saul/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rahgooy/saul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rahgooy/saul/statuses/{sha}","languages_url":"https://api.github.com/repos/Rahgooy/saul/languages","stargazers_url":"https://api.github.com/repos/Rahgooy/saul/stargazers","contributors_url":"https://api.github.com/repos/Rahgooy/saul/contributors","subscribers_url":"https://api.github.com/repos/Rahgooy/saul/subscribers","subscription_url":"https://api.github.com/repos/Rahgooy/saul/subscription","commits_url":"https://api.github.com/repos/Rahgooy/saul/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rahgooy/saul/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rahgooy/saul/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rahgooy/saul/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rahgooy/saul/contents/{+path}","compare_url":"https://api.github.com/repos/Rahgooy/saul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rahgooy/saul/merges","archive_url":"https://api.github.com/repos/Rahgooy/saul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rahgooy/saul/downloads","issues_url":"https://api.github.com/repos/Rahgooy/saul/issues{/number}","pulls_url":"https://api.github.com/repos/Rahgooy/saul/pulls{/number}","milestones_url":"https://api.github.com/repos/Rahgooy/saul/milestones{/number}","notifications_url":"https://api.github.com/repos/Rahgooy/saul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rahgooy/saul/labels{/name}","releases_url":"https://api.github.com/repos/Rahgooy/saul/releases{/id}","deployments_url":"https://api.github.com/repos/Rahgooy/saul/deployments","created_at":"2016-07-22T13:13:12Z","updated_at":"2016-07-22T13:13:13Z","pushed_at":"2017-01-17T14:24:23Z","git_url":"git://github.com/Rahgooy/saul.git","ssh_url":"git@github.com:Rahgooy/saul.git","clone_url":"https://github.com/Rahgooy/saul.git","svn_url":"https://github.com/Rahgooy/saul","homepage":"","size":14435,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/15"},"html":{"href":"https://github.com/Rahgooy/saul/pull/15"},"issue":{"href":"https://api.github.com/repos/Rahgooy/saul/issues/15"},"comments":{"href":"https://api.github.com/repos/Rahgooy/saul/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Rahgooy/saul/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/Rahgooy/saul/statuses/5455d74b9c5c86685005784dff93f4c8b8cdadda"}}}}
{"actor":{"display_login":"kordjamshidi"}}