{"action":"created","comment":{"url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/comments/78296873","id":78296873,"diff_hunk":"@@ -0,0 +1,111 @@\n+# Spatial Role Labeling\n+In paper [1], the task of spatial role labeling is introduced and an annotation scheme proposed that is language-independent and facilitates the application of machine learning techniques. The framework consists of a set of spatial roles. For a basic example, in the following sentence:\n+\n+\n+Give me [the gray book]{trajector} [on]{spatialindicator} [the big table]{landmark}.\n+\n+\n+The phrase headed by the token book is referring to a trajector object, the phrase headed by the token table is referring to the role of a landmark and these are related by the spatial expression on denoted as spatial indicator. The spatial indicator (often a preposition) establishes the type of spatial relation.\n+\n+\n+Analogous to semantic role labeling, spatial role labeling is defined as the task of automatic labeling of words or phrases in a sentence with a set of spatial roles. More speciﬁcally, it involves identifying and classifying the spatial arguments of the spatial expressions mentioned in a sentence.\n+\n+\n+## SpRL using Saul\n+In this example, we implement the best performing algorithm for [task 3 of SemEval 2012](https://www.cs.york.ac.uk/semeval-2012/task3.html) proposed in [2] using Saul.\n+\n+### Data representation and preparation\n+The SpRL data are in the form of annotated sentences, we need basic data structures to load these data and feed them to the Saul application. [`SpRLSentence`](../../../../../../../../java/edu/illinois/cs/cogcomp/saulexamples/nlp/SpatialRoleLabeling/SpRLSentence.java) and [`SpRelation`](../../../../../../../../java/edu/illinois/cs/cogcomp/saulexamples/nlp/SpatialRoleLabeling/Triplet/SpRelation.java) classes used for this purpose. In order to benefit from all of the built-in features provided by `TextAnnotation`, we used `TextAnnotation.Sentence` to represent the sentences in the `SpRLSentence` class.\n+The data sets are collections of xml files, so we used code generators to generate corresponding classes and a data reader for them.\n+\n+So, the next step is to load these files and convert them to a collection of `SpRLSentence`. In this step we split sentences in each document and convert them to `SpRLSentence` objects.\n+\n+```\n+    val reader = new SpRLDataReader(path, classOf[SpRL2013Document])\n+    reader.readData()\n+    val sentences = ListBuffer[SpRLSentence]()\n+    reader.documents.asScala.foreach(doc => {\n+      val sentenceOffsetList = getDocumentSentences(doc, version)\n+      sentenceOffsetList.foreach(s => {\n+          val ta = TextAnnotationFactory.createTextAnnotation(version, doc.getFilename + s._2, s._1)\n+          sentences += new SpRLSentence(s._2, ta.sentences.get(0), getRelations(doc, s._2).asJava)\n+      })\n+    })\n+```\n+`SpRLDataReader` is the xml data reader which loads data from the dataset. `getDocumentSentences` splits the sentences and returns a list of tuples. Each tuple contains a sentence and it's character offset in the document. \n+`TextAnnotationFactory.createTextAnnotation` uses the NLP-Pipeline to generate feature rich `TextAnnotation` for each sentence. `getRelations` returns the relations that correspond to the current sentence. \n+\n+\n+### Defining the `DataModel`\n+In order to identify spatial relations, the authors of [2] used a simple method.\n+A set of triples used to represent the spatial relations. They generated many candidates and trained a classifier to classify them. So here is the [`DataModel`](SpRLDataModel.scala) :\n+```scala\n+  // data model\n+  val sentences = node[SpRLSentence]\n+  val relations = node[SpRelation]\n+  val sentencesToRelations = edge(sentences, relations)\n+```\n+In this model, we have a set of sentences, each sentence connects to many relations through `sentencesToRelations` edges, which some of them can be `GOLD` or positive spatial relation and others that are `CANDIDATE` or non-spatial relations.\n+\n+### Sensors\n+Next step is to determine sensors:\n+```","path":"saul-examples/src/main/scala/edu/illinois/cs/cogcomp/saulexamples/nlp/SpatialRoleLabeling/README.md","position":52,"original_position":52,"commit_id":"60254295428669dcafaf3f4fbaf6979f66945306","original_commit_id":"b88bfeb75f376e064e2d1214b5c59322ed89ec98","user":{"login":"danyaljj","id":2441454,"avatar_url":"https://avatars.githubusercontent.com/u/2441454?v=3","gravatar_id":"","url":"https://api.github.com/users/danyaljj","html_url":"https://github.com/danyaljj","followers_url":"https://api.github.com/users/danyaljj/followers","following_url":"https://api.github.com/users/danyaljj/following{/other_user}","gists_url":"https://api.github.com/users/danyaljj/gists{/gist_id}","starred_url":"https://api.github.com/users/danyaljj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danyaljj/subscriptions","organizations_url":"https://api.github.com/users/danyaljj/orgs","repos_url":"https://api.github.com/users/danyaljj/repos","events_url":"https://api.github.com/users/danyaljj/events{/privacy}","received_events_url":"https://api.github.com/users/danyaljj/received_events","type":"User","site_admin":false},"body":"add scala style?","created_at":"2016-09-11T15:09:02Z","updated_at":"2016-09-11T15:09:02Z","html_url":"https://github.com/IllinoisCogComp/saul/pull/383#discussion_r78296873","pull_request_url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383","_links":{"self":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/comments/78296873"},"html":{"href":"https://github.com/IllinoisCogComp/saul/pull/383#discussion_r78296873"},"pull_request":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383","id":84744931,"html_url":"https://github.com/IllinoisCogComp/saul/pull/383","diff_url":"https://github.com/IllinoisCogComp/saul/pull/383.diff","patch_url":"https://github.com/IllinoisCogComp/saul/pull/383.patch","issue_url":"https://api.github.com/repos/IllinoisCogComp/saul/issues/383","number":383,"state":"open","locked":false,"title":"SpRL example","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":"SpRL example using Saul","created_at":"2016-09-10T04:53:23Z","updated_at":"2016-09-11T15:09:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86a0a8fae8d65a26a3f63c12b3cd481e34e6e210","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383/commits","review_comments_url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383/comments","review_comment_url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IllinoisCogComp/saul/issues/383/comments","statuses_url":"https://api.github.com/repos/IllinoisCogComp/saul/statuses/60254295428669dcafaf3f4fbaf6979f66945306","head":{"label":"Rahgooy:master","ref":"master","sha":"60254295428669dcafaf3f4fbaf6979f66945306","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":"2016-09-11T12:36:45Z","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":13428,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"IllinoisCogComp:master","ref":"master","sha":"10de99cc5833a87988f2dc25e03c2d9aacbeb3c7","user":{"login":"IllinoisCogComp","id":14893101,"avatar_url":"https://avatars.githubusercontent.com/u/14893101?v=3","gravatar_id":"","url":"https://api.github.com/users/IllinoisCogComp","html_url":"https://github.com/IllinoisCogComp","followers_url":"https://api.github.com/users/IllinoisCogComp/followers","following_url":"https://api.github.com/users/IllinoisCogComp/following{/other_user}","gists_url":"https://api.github.com/users/IllinoisCogComp/gists{/gist_id}","starred_url":"https://api.github.com/users/IllinoisCogComp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IllinoisCogComp/subscriptions","organizations_url":"https://api.github.com/users/IllinoisCogComp/orgs","repos_url":"https://api.github.com/users/IllinoisCogComp/repos","events_url":"https://api.github.com/users/IllinoisCogComp/events{/privacy}","received_events_url":"https://api.github.com/users/IllinoisCogComp/received_events","type":"Organization","site_admin":false},"repo":{"id":43462781,"name":"saul","full_name":"IllinoisCogComp/saul","owner":{"login":"IllinoisCogComp","id":14893101,"avatar_url":"https://avatars.githubusercontent.com/u/14893101?v=3","gravatar_id":"","url":"https://api.github.com/users/IllinoisCogComp","html_url":"https://github.com/IllinoisCogComp","followers_url":"https://api.github.com/users/IllinoisCogComp/followers","following_url":"https://api.github.com/users/IllinoisCogComp/following{/other_user}","gists_url":"https://api.github.com/users/IllinoisCogComp/gists{/gist_id}","starred_url":"https://api.github.com/users/IllinoisCogComp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IllinoisCogComp/subscriptions","organizations_url":"https://api.github.com/users/IllinoisCogComp/orgs","repos_url":"https://api.github.com/users/IllinoisCogComp/repos","events_url":"https://api.github.com/users/IllinoisCogComp/events{/privacy}","received_events_url":"https://api.github.com/users/IllinoisCogComp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IllinoisCogComp/saul","description":"Saul : Declarative Learning-Based Programming","fork":false,"url":"https://api.github.com/repos/IllinoisCogComp/saul","forks_url":"https://api.github.com/repos/IllinoisCogComp/saul/forks","keys_url":"https://api.github.com/repos/IllinoisCogComp/saul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IllinoisCogComp/saul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IllinoisCogComp/saul/teams","hooks_url":"https://api.github.com/repos/IllinoisCogComp/saul/hooks","issue_events_url":"https://api.github.com/repos/IllinoisCogComp/saul/issues/events{/number}","events_url":"https://api.github.com/repos/IllinoisCogComp/saul/events","assignees_url":"https://api.github.com/repos/IllinoisCogComp/saul/assignees{/user}","branches_url":"https://api.github.com/repos/IllinoisCogComp/saul/branches{/branch}","tags_url":"https://api.github.com/repos/IllinoisCogComp/saul/tags","blobs_url":"https://api.github.com/repos/IllinoisCogComp/saul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IllinoisCogComp/saul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IllinoisCogComp/saul/git/refs{/sha}","trees_url":"https://api.github.com/repos/IllinoisCogComp/saul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IllinoisCogComp/saul/statuses/{sha}","languages_url":"https://api.github.com/repos/IllinoisCogComp/saul/languages","stargazers_url":"https://api.github.com/repos/IllinoisCogComp/saul/stargazers","contributors_url":"https://api.github.com/repos/IllinoisCogComp/saul/contributors","subscribers_url":"https://api.github.com/repos/IllinoisCogComp/saul/subscribers","subscription_url":"https://api.github.com/repos/IllinoisCogComp/saul/subscription","commits_url":"https://api.github.com/repos/IllinoisCogComp/saul/commits{/sha}","git_commits_url":"https://api.github.com/repos/IllinoisCogComp/saul/git/commits{/sha}","comments_url":"https://api.github.com/repos/IllinoisCogComp/saul/comments{/number}","issue_comment_url":"https://api.github.com/repos/IllinoisCogComp/saul/issues/comments{/number}","contents_url":"https://api.github.com/repos/IllinoisCogComp/saul/contents/{+path}","compare_url":"https://api.github.com/repos/IllinoisCogComp/saul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IllinoisCogComp/saul/merges","archive_url":"https://api.github.com/repos/IllinoisCogComp/saul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IllinoisCogComp/saul/downloads","issues_url":"https://api.github.com/repos/IllinoisCogComp/saul/issues{/number}","pulls_url":"https://api.github.com/repos/IllinoisCogComp/saul/pulls{/number}","milestones_url":"https://api.github.com/repos/IllinoisCogComp/saul/milestones{/number}","notifications_url":"https://api.github.com/repos/IllinoisCogComp/saul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IllinoisCogComp/saul/labels{/name}","releases_url":"https://api.github.com/repos/IllinoisCogComp/saul/releases{/id}","deployments_url":"https://api.github.com/repos/IllinoisCogComp/saul/deployments","created_at":"2015-09-30T22:21:38Z","updated_at":"2016-09-05T13:42:18Z","pushed_at":"2016-09-11T14:50:29Z","git_url":"git://github.com/IllinoisCogComp/saul.git","ssh_url":"git@github.com:IllinoisCogComp/saul.git","clone_url":"https://github.com/IllinoisCogComp/saul.git","svn_url":"https://github.com/IllinoisCogComp/saul","homepage":"","size":14433,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":109,"forks":6,"open_issues":109,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383"},"html":{"href":"https://github.com/IllinoisCogComp/saul/pull/383"},"issue":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/issues/383"},"comments":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/IllinoisCogComp/saul/statuses/60254295428669dcafaf3f4fbaf6979f66945306"}}}}
{"actor":{"display_login":"danyaljj"}}