lapps-clarin / converter-issues

NO CODE HERE! Issue tracker for converters
0 stars 0 forks source link

Lapps grid serialization get one view while there are two views #6

Open elahi123 opened 6 years ago

elahi123 commented 6 years ago

The following lif file has two views but I think serializer .getContainer().getViews() gets only named entity view.

-----The lif file is generated by running named entity and tokenizer from http://galaxy.lappsgrid.org/

{
  "discriminator": "http://vocab.lappsgrid.org/ns/media/jsonld#lif",
  "payload": {
    "@context": "http://vocab.lappsgrid.org/context-1.0.0.jsonld",
    "metadata": {},
    "text": {
      "@value": "Karen flew to New York.\n",
      "@language": "en"
    },
    "views": [
      {
        "metadata": {
          "contains": {
            "http://vocab.lappsgrid.org/NamedEntity": {
              "producer": "edu.brandeis.cs.lappsgrid.stanford.corenlp.NamedEntityRecognizer:2.0.4",
              "type": "ner:stanford"
            }
          }
        },
        "annotations": [
          {
            "id": "ne_0",
            "start": 0,
            "end": 5,
            "@type": "http://vocab.lappsgrid.org/Person",
            "features": {
              "word": "Karen"
            }
          },
          {
            "id": "ne_1",
            "start": 14,
            "end": 17,
            "@type": "http://vocab.lappsgrid.org/Location",
            "features": {
              "word": "New"
            }
          },
          {
            "id": "ne_2",
            "start": 18,
            "end": 22,
            "@type": "http://vocab.lappsgrid.org/Location",
            "features": {
              "word": "York"
            }
          }
        ]
      },
      {
        "metadata": {
          "contains": {
            "http://vocab.lappsgrid.org/Token": {
              "producer": "edu.brandeis.cs.lappsgrid.stanford.corenlp.Tokenizer:2.0.4",
              "type": "tokenizer:stanford"
            }
          }
        },
        "annotations": [
          {
            "id": "tk_0_0",
            "start": 0,
            "end": 5,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "Karen"
            }
          },
          {
            "id": "tk_0_1",
            "start": 6,
            "end": 10,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "flew"
            }
          },
          {
            "id": "tk_0_2",
            "start": 11,
            "end": 13,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "to"
            }
          },
          {
            "id": "tk_0_3",
            "start": 14,
            "end": 17,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "New"
            }
          },
          {
            "id": "tk_0_4",
            "start": 18,
            "end": 22,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "York"
            }
          },
          {
            "id": "tk_0_5",
            "start": 22,
            "end": 23,
            "@type": "http://vocab.lappsgrid.org/Token",
            "features": {
              "word": "."
            }
          }
        ]
      }
    ]
  }
}
ksuderman commented 6 years ago

I am not sure what method you mean; the Serializer does not have a getContainer() method. However, the following works as expected:

#!/usr/bin/env lsd

def tokenizer = new ServiceClient('http://eldrad.cs-i.brandeis.edu:8080/service_manager/invoker/brandeis_eldrad_grid_1:stanfordnlp.tokenizer_2.0.4', 'tester', 'tester')
def ner = new ServiceClient('http://eldrad.cs-i.brandeis.edu:8080/service_manager/invoker/brandeis_eldrad_grid_1:stanfordnlp.namedentityrecognizer_2.0.4', 'tester', 'tester')

Container container = new Container()
container.text = 'Karen flew to New York'

String json = new Data(Uri.LIF, container).asJson()
println 'Running the tokenizer'
json = tokenizer.execute(json)
println 'Running the NE recognizer'
json = ner.execute(json)
println 'Serializing'
Data data = Serializer.parse(json)
println data.discriminator

container = new Container(data.payload)
assert container.getViews().size() == 2
println 'PASSED'