Git Product home page Git Product logo

parsey-mcparseface-server's Introduction

Parsey McParseface server

A simple Python Flask app to provide Parsey McParseface over HTTP as an API.

Based on https://github.com/JoshData/parsey-mcparseface-server

To run:

Run once on port 7777:

$ docker run -it --rm -p 7777:80 andersrye/parsey-mcparseface-server

or detached:

$ docker run -d -it --name -p 7777:80 parseyserver andersrye/parsey-mcparseface-server    

To build:

$ git clone https://github.com/andersrye/parsey-mcparseface-server.git
$ cd parsey-mcparseface-server
$ docker build -t parseyserver .
$ docker run -it --rm -p 7777:80 parseyserver

To use:

Post plain text, line separated sentences to it:

$ curl -H "Content-Type:text/plain" -d "Bob brought the pizza to Alice." http://localhost:7777/

Returns a list (!) of JSON trees:

[
  {
    "sentence": "Bob brought the pizza to Alice.",
    "tree": {
      "ROOT": [
        {
          "index": 2,
          "token": "brought",
          "label": "VERB",
          "pos": "VBD",
          "tree": {
            "nsubj": [
              {
                "index": 1,
                "token": "Bob",
                "label": "NOUN",
                "pos": "NNP"
              }
            ],
            "dobj": [
              {
                "index": 4,
                "token": "pizza",
                "label": "NOUN",
                "pos": "NN",
                "tree": {
                  "det": [
                    {
                      "index": 3,
                      "token": "the",
                      "label": "DET",
                      "pos": "DT"
                    }
                  ]
                }
              }
            ],
            "prep": [
              {
                "index": 5,
                "token": "to",
                "label": "ADP",
                "pos": "IN",
                "tree": {
                  "pobj": [
                    {
                      "index": 6,
                      "token": "Alice",
                      "label": "NOUN",
                      "pos": "NNP"
                    }
                  ]
                }
              }
            ],
            "punct": [
              {
                "index": 7,
                "token": ".",
                "label": ".",
                "pos": "."
              }
            ]
          }
        }
      ]
    }
  }
]

Or given some sentences.txt:

Bob has a burger.
Name this boat.
Alice sends a message.

then

$ curl -H "Content-Type:text/plain" --data-binary @sentences.txt http://localhost:7777/

gives

[
  {
    "sentence": "Bob has a burger.",
    "tree": {
      "ROOT": [
        {
          "index": 2,
          "token": "has",
          "label": "VERB",
          "pos": "VBZ",
          "tree": {
            "nsubj": [
              {
                "index": 1,
                "token": "Bob",
                "label": "NOUN",
                "pos": "NNP"
              }
            ],
            "dobj": [
              {
                "index": 4,
                "token": "burger",
                "label": "NOUN",
                "pos": "NN",
                "tree": {
                  "det": [
                    {
                      "index": 3,
                      "token": "a",
                      "label": "DET",
                      "pos": "DT"
                    }
                  ]
                }
              }
            ],
            "punct": [
              {
                "index": 5,
                "token": ".",
                "label": ".",
                "pos": "."
              }
            ]
          }
        }
      ]
    }
  },
  <etc, etc...>
]

parsey-mcparseface-server's People

Contributors

joshdata avatar lomilar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.