NlpTools is a set of php 8.1+ classes for beginner to semi advanced natural language processing work.
You can find documentation and code examples at the project's homepage.
Lda is still experimental and quite slow but it works. See an example.
- K-Means
- Hierarchical Agglomerative Clustering
- SingleLink
- CompleteLink
- GroupAverage
- WhitespaceTokenizer
- WhitespaceAndPunctuationTokenizer
- PennTreebankTokenizer
- RegexTokenizer
- ClassifierBasedTokenizer This tokenizer allows us to build a lot more complex tokenizers than the previous ones
- TokensDocument represents a bag of words model for a document.
- WordDocument represents a single word with the context of a larger document.
- TrainingDocument represents a document whose class is known.
- TrainingSet a collection of TrainingDocuments
- FunctionFeatures Allows the creation of a feature factory from a number of callables
- DataAsFeatures Simply return the data as features.
- A gradient descent optimizer (written in php) for educational use. It is a simple implementation for anyone wanting to know a bit more about either GD or MaxEnt models
- A fast (faster than nltk-scipy), parallel gradient descent optimizer written in Go. This optimizer resides in another repo, it is used via the external optimizer. TODO: At least write a readme for the optimizer written in Go.
- Idf Inverse document frequency
- Stop words
- Language based normalizers
- Classifier based transformation for creating flexible preprocessing pipelines
- Test classes should be in the same namespace as the class that is being tested
- Any data needed for the test or produced by the test should be in the 'data' directory under the same folder as the namespace. Only data needed (not produced) are commited to the repository.
- Tests should be marked with the groups Slow and VerySlow if they require more than 10 seconds and 1 minute respectively. If a test is marked as VerySlow it should also be marked as Slow.
- Both functional and unit tests are welcome.
Currently only one testsuite is defined (all tests). Because some tests take a long time to
run you can try running phpunit --exclude-group Slow
or phpunit --exclude-group VerySlow
to avoid some slow tests.
PHPUnit should be run from inside the tests folder or the phpunit.xml file should be provided as config.