npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

core-nlp-wrapper

v1.1.0

Published

Stanford Lexicalized Parser v4.2.1

Downloads

5

Readme

core-nlp-wrapper

Análisis gramatical de texto.

Instalación

npm i core-nlp-wrapper

Esto instalará el binario parse_natural_file y lo dejará usable desde línea de comandos.

Completar la instalación

Primero, situar la página donde están todas las versiones históricas de este software. Y es aquí:

Nosotros, en un primer momento, estamos usando la versión 4.2.1.

El fichero perdido

Bueno, es un proyecto un poco especial, porque requiere de ficheros grandes. Y hay un problema: Github pone un límite de espacio por fichero para alojar. Y en el proyecto, hay 1 fichero que sobrepasa este límite. Ese fichero, en la instalación con npm de core-nlp-wrapper, no está incluído.

Por todo esto, hay que descargarse este zip de aquí:

Así, entonces, el comando de consola: parse_natural_file file.txt debería encontrar todos los ficheros que va a requerir del proyecto.

El fichero para castellano

Para este proyecto, creo que no voy a dar soporte en castellano, tristemente. Creo que en castellano no está tan bien hecho, tristemente. Quería hacerlo, pero me temo que no es tan buena idea, y que mejor se queda en inglés. Al menos, este.

El binario de Java

CoreNLP funciona con Java. Para que todo funcione bien, no estoy seguro de cuántas cosas hay que tener. En principio, dicen, solo Java 8 o 9. Supongo que mayor también. Al final he conseguido hacerlo funcionar así así, pero no con Gradle ni con Maven, sino bajándome la versión "standalone" del proyecto de su página web, aquí concretamente: https://stanfordnlp.github.io/CoreNLP/parser-standalone.html. Entonces, si abres el fichero README.txt, que es parte de su proyecto y no del mío, ves la instrucción para hacerlo funcionar por consola. Ahí puedes encontrar más cosas de cómo funciona el programa que ellos dan.

Proyecto extendido

Todos los ficheros de este proyecto son los suyos. Yo sólo he añadido:

  • README.md, que es este fichero.
  • core-nlp-wrapper.js, que es la función que parsea un fichero y te devuelve la estructura, como módulo para node.js.
  • core-nlp-wrapper.bin.js, que es el binario que se puede usar por consola mediante parse_natural_file file.txt.
  • package.json, en su proyecto no usan node.js para nada, por eso este fichero sí es nuestro. También lo usamos para importar una librería que nos permite pasar XML a JSON de NPM, porque su prorgama nos devuelve un XML para representar la estructura.

Ejecución vía consola

parse_natural_file file.txt > file.json

En file.txt va un texto en inglés en un fichero de texto plano.

En file.json encontraremos la salida del procesamiento, en un JSON, que representa un XML, que representa la base de un análisis gramatical.

Ejecución vía API de Node.js

Puedes analizar textos: (o ver test/example.002.js)

const analizador_gramatical = require("core-nlp-wrapper");
const analisis_gramatical = await analizador_gramatical.parse_text("This sentence should be parsed blazing fast by the library.");
console.log(analisis_gramatical);

Y puedes analizar ficheros: (o ver test/example.001.js)

// 1: Preparas el fichero
const fs = require("fs");
const file = "file.txt";
const text = "This is a simple text in a file, written in English, that will be easily parsed by this monster from Stanford.";
fs.writeFileSync(file, text, "utf8");

// 2: Lo analizas
const analizador_gramatical = require("core-nlp-wrapper");
const analisis_gramatical = await analizador_gramatical.parse_file(file);

console.log(analisis_gramatical);

Tabla de categorías

| ID | Categoría | |----|----| | root | root | | dep | dependent | | aux | auxiliary | | auxpass | passive auxiliary | | cop | copula | | arg | argument | | agent | agent | | comp | complement | | acomp | adjectival complement | | ccomp | clausal complement with internal subject | | xcomp | clausal complement with external subject | | obj | object | | dobj | direct object | | iobj | indirect object | | pobj | object of preposition | | subj | subject | | nsubj | nominal subject | | nsubjpass | passive nominal subject | | csubj | clausal subject | | csubjpass | passive clausal subject | | cc | coordination | | conj | conjunct | | expl | expletive (expletive “there”) | | mod | modifier | | amod | adjectival modifier | | appos | appositional modifier | | 11advcl | adverbial clause modifier | | det | determiner | | predet | predeterminer | | preconj | preconjunct | | vmod | reduced, non-finite verbal modifier | | mwe | multi-word expression modifier | | mark | marker (word introducing an advcl or ccomp | | advmod | adverbial modifier | | neg | negation modifier | | rcmod | relative clause modifier | | quantmod | quantifier modifier | | nn | noun compound modifier | | npadvmod | noun phrase adverbial modifier | | tmod | temporal modifier | | num | numeric modifier | | number | element of compound number | | prep | prepositional modifier | | poss | possession modifier | | possessive | possessive modifier (’s) | | prt | phrasal verb particle | | parataxis | parataxis | | goeswith | goes with | | punct | punctuation | | ref | referent | | sdep | semantic dependent | | xsubj | controlling subject |

Versiones

La mínima versión que te diría de usar es la 1.1.0. Y de momento es la última, así que tampoco es muy fiable. Pero tiene unos tests, y en mi PC los pasa. Con npm run test.