Skip to content

NaturalNode/natural

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* [WIP] Update TS declarations

Importing natural in typescript projects using the provided type
declarations won't work until the declaration files themselves can be
compiled without errors. These are the minimum changes needed to resolve
the remaining errors.

* SentenceAnalyzer: Update TS declarations

- TaggedWord: Add property pp and remove index because there don't appear
  to be any other keys.
- TaggedSentence: punct() method is called in type() without checking for
  existence first, so should not be optional.
- SenType: Define the only possible strings that can be assigned to
  .sentType as an enum.
- SentenceAnalyzer: subjectToString() and predicateToString() can only
  return strings because ['a', null, 'b'].join('') === 'ab'.

* [WIP] BrillPosTagger: Update TS declarations

- Add RuleTemplate and index RuleTemplates
- Use Sentence type for several sentence parameters
- Replace non-existent function() method in Predicate with property meta
- Add properties and methods to TransformationRule, RuleSet, Corpus
- TODO: BrillPOSTagger, BrillPOSTester, BrillPOSTrainer

* BrillPosTagger: Update TS declarations

- Add remaining methods to BrillPOSTagger
- Add classes for BrillPOSTester, BrillPOSTrainer

* Address linting errors

* [WIP] Update classifier TS declarations

- Add apparatus classifier declarations since that library doesn't
  output types
- Make BayesClassifier and LogisticRegressionClassifier extend a common
  ClassifierBase class
- Update some any types
- Update classifiers test with updated types

* [WIP] Update error types in classifier callbacks

- null value expected when no error

* [WIP] Update classifier TS declarations

Some of these changes need to be revisited for accuracy.

- Add constructors to classes that extend a base class
- Remove unnecessary 'export' from 'declare class' (still confused about
  what needs an explicit export in .d.ts files, will have to test)
- Review types of all properties, methods, and arguments

* Update distance TS declarations

- Remove redundant '| undefined' from optional interface members and
  arguments
- Add offset member to SubstringDistanceResult
- Add hamming distance function

* Remove semicolon

* Update inflectors TS declarations

* Update ngrams TS declarations

- Add overloads for stats output
- Add multigrams function

* Add normalizers TS declarations

* Update phonetics TS declarations

- Create generic Phonetic to use as base functions for each export
- Add missing functions
- Add SoundExDM

* Address lint errors

* Address linting errors

* Update sentiment TS declarations

- Overload constructor to indicate only certain languages are available
  for a limited set of language types.

* Adopt convention for export vs. declare

Reserve export keyword for members of a module that are actually
exported in the corresponding index.js. For everything else, use declare
to make the type/instance available.

Example:
index.js contains: exports.SomeClass = require('...')
index.d.ts should then only have one exported item: export SomeClass ...
and any types needed to support SomeClass use declare.

TODO: Needs confirmation of validity

* Add missing exports in inflectors TS declarations

* Update stemmer TS declarations

- Add missing functions to Stemmer interface
- Follow declare vs. export convention

* Update tfidf TS declarations

- Update argument and return types of TfIdf methods
- Add missing methods to TfIdf
- Add missing members to TfIdfTerm
- Follow export vs. declare convention

* Update tokenizers TS declarations

- Update class inheritances
- Add missing options member
- Add missing class methods
- Follow export vs. declare convention

* Update transliterators TS declarations

- Simplify declaration

* Update trie TS declarations

- Follow export vs. declare convention
- Add missing method to Trie
- Align argument names with source

* Update util TS declarations

- Add missing methods to classes
- Follow export vs. declare convention

* Update wordnet TS declarations

- Follow export vs. declare convention
- Add missing methods to WordNet class
- Add dependent types for WordNet method arguments

* Address lint errors

* Address lint errors
1d8c308

Git stats

Files

Permalink
Failed to load latest commit information.

natural

NPM version Node.js CI JavaScript Style Guide GitHub Super-Linter Coverage Status CII Best Practices TypeScript support

"Natural" is a general natural language facility for nodejs. It offers a broad range of functionalities for natural language processing. Documentation can be found here on GitHub Pages.

Open source licenses

Natural: MIT License

Copyright (c) 2011, 2012 Chris Umbel, Rob Ellis, Russell Mull, Hugo W.L. ter Doest

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

WordNet License

This license is available as the file LICENSE in any downloaded version of WordNet. WordNet 3.0 license: (Download)

WordNet Release 3.0 This software and database is being provided to you, the LICENSEE, by Princeton University under the following license. By obtaining, using and/or copying this software and database, you agree that you have read, understood, and will comply with these terms and conditions.: Permission to use, copy, modify and distribute this software and database and its documentation for any purpose and without fee or royalty is hereby granted, provided that you agree to comply with the following copyright notice and statements, including the disclaimer, and that the same appear on ALL copies of the software, database and documentation, including modifications that you make for internal use or for distribution. WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved. THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. The name of Princeton University or Princeton may not be used in advertising or publicity pertaining to distribution of the software and/or database. Title to copyright in this software, database and any associated documentation shall at all times remain with Princeton University and LICENSEE agrees to preserve same.

Porter stemmer German: BSD License

The Porter stemmer for German is licensed by a BSD license. It states Standard BSD License in the source code, interpreted as the original BSD license consisting of four clauses.