PHPackages                             flaneurette/natural-grammar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. flaneurette/natural-grammar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

flaneurette/natural-grammar
===========================

A class to process text and auto–correct grammar

101PHP

Since Apr 19Pushed 2mo agoCompare

[ Source](https://github.com/flaneurette/Natural-Grammar)[ Packagist](https://packagist.org/packages/flaneurette/natural-grammar)[ RSS](/packages/flaneurette-natural-grammar/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Natural-Grammar
===============

[](#natural-grammar)

A class to process text and auto–correct grammar following the guidelines as described in the Chicago Manual of Style. Close to artificial intelligence, it use natural language processing to correct grammar, like a human copy editor would correct a text. A thesaurus is used to beautify certain words without overdoing it. The class also compares hundreds of natural grammar fragments which I extracted and constructed from reading and editing many (news) articles and books. Any replacements made are randomized through a thesaurus, in such a way, that the text flows natural instead of being overcorrected. It does some minor auto–corrections on justifiable spelling; it only replaces that which it can safely replace, leaving room for copy editors to gloss over the text without the strain of obvious mistakes. As spellchecking is senstive to false positives, the class does not have a complete spellchecker. The class autocorrects the most common mispelled words, which consists of a list of about 200 words, acceptable for any English text.

Auto–correction includes:

```
   Ablaut reduplication
   Adjective ordering  (proposed)
   Anglicized words
   Character repeats
   Capitals
   Dashes
   Diagramming (proposed)
   Exaggerations (characters,values)
   Grammar fragments
   Hyperbole
   Indivisible words
   Invalid conjunctions
   Invalid comparisons
   Inaudible H
   It's vs Its
   Spelling mistakes
   Slang fragments
   Overuse of contractions
   Overuse of conjunctions "But"
   Oxford comma (replacing it)
   Punctuation
   Past tense correction
   Paragraph identation

```

Installing
==========

[](#installing)

The class can be installed via two methods, composer and manual installation.

### Composer:

[](#composer)

```
composer require flaneurette/natural-grammar:dev-main

```

### Manual:

[](#manual)

Clone or download the dev-main or package if available.

Example code:
=============

[](#example-code)

```
   $run     = new grammar();
   $text    = 'We were starting to ski downhill in my 1000$ camoflage suit, like I did a million times before. Then, I chnaged my mind. "Help!!!" I said. Jane heard me. She said: "What's wrong"? Oooooooouch!!!';
   $grammar = $run->grammary($text);

   echo $grammar;

```

Example text
============

[](#example-text)

*We were starting to ski downhill in my 1000$ camoflage suit, like I did a million times before. Then, I chnaged my mind. "Help!!!" I said. Jane heard me. She said: "What's wrong"? Oooooooouch!!!*

Breakdown:
==========

[](#breakdown)

*We were starting to ski downhill in my 1000 $ camoflage suit, like I did a million times before. Then, I chnaged my mind. "Help !!! " I said. Jane heard me. She said : "What's wrong" ?O oooooo ouch !! !*

Corrected text:
===============

[](#corrected-text)

*We started to ski downhill in my $1000 camouflage suit, like I did many times before. Then, I changed my mind. "Help!" I said. Jane heard me. She said, "What's wrong?" Oouch!*

License
=======

[](#license)

Copyright 2019 Alexandra van den Heetkamp. This class is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. Be sure to include the attached license when you distribute the software.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance56

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb5dbd08cc443682386bf44fe4eb61bf46425611a12fd5b2b067f7953548f6f5?d=identicon)[flaneurette](/maintainers/flaneurette)

---

Top Contributors

[![flaneurette](https://avatars.githubusercontent.com/u/30347642?v=4)](https://github.com/flaneurette "flaneurette (147 commits)")

### Embed Badge

![Health badge](/badges/flaneurette-natural-grammar/health.svg)

```
[![Health](https://phpackages.com/badges/flaneurette-natural-grammar/health.svg)](https://phpackages.com/packages/flaneurette-natural-grammar)
```

###  Alternatives

[sensorsdata/sa-sdk-php

PHP SDK for Sensors Analytics

32343.4k2](/packages/sensorsdata-sa-sdk-php)[phamda/phamda

Auto-curried function library

1922.8k](/packages/phamda-phamda)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
