Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nlptoolkit-dependencyparser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlptoolkit-dependencyparser - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

en_atis-ud-dev.conllu

50

dist/Universal/UniversalDependencyTreeBankCorpus.js

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "nlptoolkit-corpus/dist/Corpus", "fs", "./UniversalDependencyTreeBankSentence", "./UniversalDependencyRelation", "./UniversalDependencyTreeBankFeatures", "./UniversalDependencyTreeBankWord", "../ParserEvaluationScore"], factory);
define(["require", "exports", "nlptoolkit-corpus/dist/Corpus", "fs", "./UniversalDependencyTreeBankSentence", "../ParserEvaluationScore"], factory);
}

@@ -17,5 +17,2 @@ })(function (require, exports) {

const UniversalDependencyTreeBankSentence_1 = require("./UniversalDependencyTreeBankSentence");
const UniversalDependencyRelation_1 = require("./UniversalDependencyRelation");
const UniversalDependencyTreeBankFeatures_1 = require("./UniversalDependencyTreeBankFeatures");
const UniversalDependencyTreeBankWord_1 = require("./UniversalDependencyTreeBankWord");
const ParserEvaluationScore_1 = require("../ParserEvaluationScore");

@@ -25,3 +22,3 @@ class UniversalDependencyTreeBankCorpus extends Corpus_1.Corpus {

super();
let sentence = undefined;
let sentence = "";
let data = fs.readFileSync(fileName, 'utf8');

@@ -31,44 +28,7 @@ let lines = data.split("\n");

if (line.length == 0) {
this.addSentence(sentence);
sentence = undefined;
this.addSentence(new UniversalDependencyTreeBankSentence_1.UniversalDependencyTreeBankSentence(sentence));
sentence = "";
}
else {
if (line.startsWith("#")) {
if (sentence == null) {
sentence = new UniversalDependencyTreeBankSentence_1.UniversalDependencyTreeBankSentence();
}
sentence.addComment(line.trim());
}
else {
let items = line.split("\t");
if (items.length != 10) {
console.log("Line does not contain 10 items ->" + line);
}
else {
let id = items[0];
if (id.match("^\\d+$")) {
let surfaceForm = items[1];
let lemma = items[2];
let upos = UniversalDependencyRelation_1.UniversalDependencyRelation.getDependencyPosType(items[3]);
if (upos == undefined) {
console.log("Line does not contain universal pos ->" + line);
}
let xpos = items[4];
let features = new UniversalDependencyTreeBankFeatures_1.UniversalDependencyTreeBankFeatures(items[5]);
let relation;
if (items[6] != "_") {
let to = Number.parseInt(items[6]);
let dependencyType = items[7].toUpperCase();
relation = new UniversalDependencyRelation_1.UniversalDependencyRelation(to, dependencyType);
}
else {
relation = undefined;
}
let deps = items[8];
let misc = items[9];
let word = new UniversalDependencyTreeBankWord_1.UniversalDependencyTreeBankWord(Number.parseInt(id), surfaceForm, lemma, upos, xpos, features, relation, deps, misc);
sentence.addWord(word);
}
}
}
sentence += line + "\n";
}

@@ -75,0 +35,0 @@ }

@@ -5,3 +5,3 @@ import { Sentence } from "nlptoolkit-corpus/dist/Sentence";

private comments;
constructor();
constructor(sentence?: string);
addComment(comment: string): void;

@@ -8,0 +8,0 @@ toString(): string;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "nlptoolkit-corpus/dist/Sentence", "../ParserEvaluationScore"], factory);
define(["require", "exports", "nlptoolkit-corpus/dist/Sentence", "./UniversalDependencyTreeBankWord", "../ParserEvaluationScore", "./UniversalDependencyRelation", "./UniversalDependencyTreeBankFeatures"], factory);
}

@@ -15,7 +15,53 @@ })(function (require, exports) {

const Sentence_1 = require("nlptoolkit-corpus/dist/Sentence");
const UniversalDependencyTreeBankWord_1 = require("./UniversalDependencyTreeBankWord");
const ParserEvaluationScore_1 = require("../ParserEvaluationScore");
const UniversalDependencyRelation_1 = require("./UniversalDependencyRelation");
const UniversalDependencyTreeBankFeatures_1 = require("./UniversalDependencyTreeBankFeatures");
class UniversalDependencyTreeBankSentence extends Sentence_1.Sentence {
constructor() {
constructor(sentence) {
super();
this.comments = new Array();
if (sentence != undefined) {
let lines = sentence.split("\n");
for (let line of lines) {
if (line == "") {
continue;
}
if (line.startsWith("#")) {
this.addComment(line.trim());
}
else {
let items = line.split("\t");
if (items.length != 10) {
console.log("Line does not contain 10 items ->" + line);
}
else {
let id = items[0];
if (id.match("^\\d+$")) {
let surfaceForm = items[1];
let lemma = items[2];
let upos = UniversalDependencyRelation_1.UniversalDependencyRelation.getDependencyPosType(items[3]);
if (upos == undefined) {
console.log("Line does not contain universal pos ->" + line);
}
let xpos = items[4];
let features = new UniversalDependencyTreeBankFeatures_1.UniversalDependencyTreeBankFeatures(items[5]);
let relation;
if (items[6] != "_") {
let to = Number.parseInt(items[6]);
let dependencyType = items[7].toUpperCase();
relation = new UniversalDependencyRelation_1.UniversalDependencyRelation(to, dependencyType);
}
else {
relation = undefined;
}
let deps = items[8];
let misc = items[9];
let word = new UniversalDependencyTreeBankWord_1.UniversalDependencyTreeBankWord(Number.parseInt(id), surfaceForm, lemma, upos, xpos, features, relation, deps, misc);
this.addWord(word);
}
}
}
}
}
}

@@ -22,0 +68,0 @@ addComment(comment) {

{
"name": "nlptoolkit-dependencyparser",
"version": "1.0.0",
"version": "1.0.1",
"description": "Turkish Dependency Parser Library",

@@ -23,6 +23,6 @@ "main": "index.js",

"mocha": "^9.1.3",
"nlptoolkit-corpus": "^1.0.2",
"nlptoolkit-corpus": "^1.0.5",
"nlptoolkit-datastructure": "^1.0.0",
"nlptoolkit-dictionary": "^1.0.2",
"nlptoolkit-morphologicalanalysis": "^1.0.1",
"nlptoolkit-dictionary": "^1.0.4",
"nlptoolkit-morphologicalanalysis": "^1.0.3",
"nlptoolkit-xmlparser": "^1.0.4",

@@ -29,0 +29,0 @@ "ts-node": "^10.4.0",

import {Corpus} from "nlptoolkit-corpus/dist/Corpus";
import * as fs from "fs";
import {UniversalDependencyTreeBankSentence} from "./UniversalDependencyTreeBankSentence";
import {UniversalDependencyRelation} from "./UniversalDependencyRelation";
import {UniversalDependencyTreeBankFeatures} from "./UniversalDependencyTreeBankFeatures";
import {UniversalDependencyTreeBankWord} from "./UniversalDependencyTreeBankWord";
import {ParserEvaluationScore} from "../ParserEvaluationScore";

@@ -13,3 +10,3 @@

super();
let sentence = undefined
let sentence = ""
let data = fs.readFileSync(fileName, 'utf8')

@@ -19,41 +16,6 @@ let lines = data.split("\n")

if (line.length == 0){
this.addSentence(sentence);
sentence = undefined;
this.addSentence(new UniversalDependencyTreeBankSentence(sentence));
sentence = "";
} else {
if (line.startsWith("#")){
if (sentence == null){
sentence = new UniversalDependencyTreeBankSentence();
}
sentence.addComment(line.trim());
} else {
let items = line.split("\t");
if (items.length != 10){
console.log("Line does not contain 10 items ->" + line);
} else {
let id = items[0];
if (id.match("^\\d+$")){
let surfaceForm = items[1];
let lemma = items[2];
let upos = UniversalDependencyRelation.getDependencyPosType(items[3]);
if (upos == undefined){
console.log("Line does not contain universal pos ->" + line);
}
let xpos = items[4];
let features = new UniversalDependencyTreeBankFeatures(items[5]);
let relation
if (items[6] != "_"){
let to = Number.parseInt(items[6]);
let dependencyType = items[7].toUpperCase();
relation = new UniversalDependencyRelation(to, dependencyType);
} else {
relation = undefined;
}
let deps = items[8];
let misc = items[9];
let word = new UniversalDependencyTreeBankWord(Number.parseInt(id), surfaceForm,
lemma, upos, xpos, features, relation, deps, misc);
sentence.addWord(word);
}
}
}
sentence += line + "\n";
}

@@ -60,0 +22,0 @@ }

import {Sentence} from "nlptoolkit-corpus/dist/Sentence";
import {UniversalDependencyTreeBankWord} from "./UniversalDependencyTreeBankWord";
import {ParserEvaluationScore} from "../ParserEvaluationScore";
import {UniversalDependencyRelation} from "./UniversalDependencyRelation";
import {UniversalDependencyTreeBankFeatures} from "./UniversalDependencyTreeBankFeatures";

@@ -9,4 +11,45 @@ export class UniversalDependencyTreeBankSentence extends Sentence{

constructor() {
constructor(sentence?: string) {
super();
if (sentence != undefined){
let lines = sentence.split("\n")
for (let line of lines){
if (line == ""){
continue
}
if (line.startsWith("#")){
this.addComment(line.trim());
} else {
let items = line.split("\t");
if (items.length != 10){
console.log("Line does not contain 10 items ->" + line);
} else {
let id = items[0];
if (id.match("^\\d+$")){
let surfaceForm = items[1];
let lemma = items[2];
let upos = UniversalDependencyRelation.getDependencyPosType(items[3]);
if (upos == undefined){
console.log("Line does not contain universal pos ->" + line);
}
let xpos = items[4];
let features = new UniversalDependencyTreeBankFeatures(items[5]);
let relation
if (items[6] != "_"){
let to = Number.parseInt(items[6]);
let dependencyType = items[7].toUpperCase();
relation = new UniversalDependencyRelation(to, dependencyType);
} else {
relation = undefined;
}
let deps = items[8];
let misc = items[9];
let word = new UniversalDependencyTreeBankWord(Number.parseInt(id), surfaceForm,
lemma, upos, xpos, features, relation, deps, misc);
this.addWord(word);
}
}
}
}
}
}

@@ -13,0 +56,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc