Language tool to convert text according to the Portuguese Language Orthographic Agreement of 1990 (PT AO90)
Installation can be done with Composer, by requiring this package as a dependency:
composer require pedro-mendonca/convert-pt-ao90
Make sure to include composer autoload in your project:
/**
* Include Composer autoload.
*/
require 'vendor/autoload.php';
If you don't use Composer, you can install manually by downloading the latest release, add it to your project folder and include the main file in your code:
/**
* Include Convert-PT-AO90.
*/
require_once '<path-to-folder>/convert-pt-ao90/convert-pt-ao90.php';
Examples:
-
Convert text string:
$text = 'Não me pélo pelo pêlo de quem pára para resistir!'; $string_ao90 = Convert_PT_AO90\convert_pt_ao90( $text ); echo $string_ao90;
-
See more examples and the complete replace pairs in the file example.php.
- Fix converting strings with trailing space returning null.
- Update dependencies.
- Add more test cases.
- Tested up to PHP 8.3.
- Fix variable type error.
- Add some more replace pairs.
- Rebuild replace pairs.
- Update dependencies.
- Tested only on supported PHP versions (7.4+).
- Fix matching for words with exact case on the replace pairs.
- Rebuild replace pairs with half the size.
- Improve performance by using only lowercase replace pairs.
- Fix matching words starting with an accented vowel.
- Remove wrong replace pairs about cardinal points (lowercased since 1945).
- Add some more replace pairs.
- Update dependencies.
- Rebuild replace pairs.
- Fix sentence boundary issue with HTML after ending.
- Add sentence boundary after two new lines.
- Add more tests: new lines followed by HTML.
- Fix JSON path issue when used as dependency.
- Rebuild code to allow a detailed control over sentence and word boundaries.
- Fix problem of partial find+replace of words, now only whole words can be converted.
- Remove temporary bug fix of partial find+replace (acto->ato).
- Update main replace pairs library.
- Add more custom replace pairs rules.
- Rebuild and add both replace pairs JSON, minified and source (pretty).
- Add more tests for many different types of texts: Multiline, HTML, multiple sentences, etc.
- Use a pre-built Replace Pairs JSON file to improve performance (5x faster).
- Simplify Replace Pairs data.
- Bump minimum PHP to 7.2.
- Add Tests! Run the Convert PT AO90 against a set of text strings with expected results.
- Add some custom replace pairs rules.
- Move CI to GitHub Actions.
- Bump PHPStan Level to 9.
- Add Markdownlint and PHPMD.
- Fix coding standards.
- Fix autoload and library path for package installed as composer dependency.
- Add Composer install support.
- Initial release.