Skip to content

Commit

Permalink
Merge pull request #1 from byjg/4.9
Browse files Browse the repository at this point in the history
4.9
  • Loading branch information
byjg committed Jan 5, 2024
2 parents 176be15 + fb51d6f commit e56b364
Show file tree
Hide file tree
Showing 15 changed files with 506 additions and 335 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PHPUnit
on:
push:
branches:
- master
tags:
- "*.*.*"
pull_request:
branches:
- master

jobs:
Build:
runs-on: 'ubuntu-latest'
container: 'byjg/php:${{ matrix.php-version }}-cli'
strategy:
matrix:
php-version:
- "8.2"
- "8.1"
- "8.0"
- "7.4"

steps:
- uses: actions/checkout@v4
- run: composer install
- run: ./vendor/bin/phpunit

Documentation:
if: github.ref == 'refs/heads/master'
needs: Build
uses: byjg/byjg.github.io/.github/workflows/add-doc.yaml@master
with:
folder: php
project: ${{ github.event.repository.name }}
secrets: inherit

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor
composer.lock
nbproject/private
.idea
.phpunit.result.cache
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Fonema BR

[![Opensource ByJG](https://img.shields.io/badge/opensource-byjg.com-brightgreen.svg)](http://opensource.byjg.com)
[![Build Status](https://travis-ci.org/byjg/fonemabr.svg?branch=master)](https://travis-ci.org/byjg/fonemabr)
[![Build Status](https://github.com/byjg/php-fonemabr/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-fonemabr/actions/workflows/phpunit.yml)
[![Opensource ByJG](https://img.shields.io/badge/opensource-byjg-success.svg)](http://opensource.byjg.com)
[![GitHub source](https://img.shields.io/badge/Github-source-informational?logo=github)](https://github.com/byjg/php-fonemabr/)
[![GitHub license](https://img.shields.io/github/license/byjg/php-fonemabr.svg)](https://opensource.byjg.com/opensource/licensing.html)
[![GitHub release](https://img.shields.io/github/release/byjg/php-fonemabr.svg)](https://github.com/byjg/php-fonemabr/releases/)

O Fonema BR tem por objetivo criar uma simplificação de palavras de tal forma que erros de ortografia e
vogais não interfiram na busca. Dessa forma, é possível criar sistemas de buscas mais aproximados com o
Expand All @@ -13,21 +16,39 @@ apenas uma simplificação.
*Nem todas as situações foram testadas. Caso encontre alguma divergência, por favor, sinta-se à vontade para
fazer um pull request*

# Exemplos
## Exemplos

### Metafone

```php
$fonema = new \ByJG\FonemaBR();
$metaphone = new \ByJG\WordProcess\Portuguese\Metaphone();

echo $metaphone->convert('brasília');
echo $metaphone->convert('brazilia');
```

### Soundex

// Abaixo, será produzido o mesmo resultado: BRZL
$fonema->converte('brasília');
$fonema->converte('brazilia');
$fonema->converte('brasil');
```php
$soundex = new \ByJG\WordProcess\Portuguese\Soundex();
echo $soundex->process('brasília');
echo $soundex->process('brazilia');
echo $soundex->process('brasil');
```

# Sugestão de usos:
## Sugestão de usos:

Uma possível utilização é criar um segundo campo no banco de dados no qual o fonema será armazenado.
Sempre que salvar a palavra original você também salva a palavra com fonema.

Dessa forma você poderá pesquisar tanto a palavra original quanto a palavra simplifica com o Fonema.

## Dependencies

```mermaid
flowchart TD
byjg/fonemabr --> byjg/convert
```

----
[Open source ByJG](http://opensource.byjg.com)
66 changes: 0 additions & 66 deletions _config.yml

This file was deleted.

7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"license": "MIT",
"description": "O Fonema BR tem por objetivo criar uma simplificação de palavras de tal forma que erros de ortografia e vogais não interfiram na busca",
"require": {
"byjg/convert": "^1.0"
"php": ">=7.4",
"byjg/convert": "4.9.*"
},
"require-dev": {
"phpunit/phpunit": "5.7.*|7.4.*"
"phpunit/phpunit": "5.7.*|7.4.*|^9.6"
},
"autoload": {
"psr-4": {
"ByJG\\": "src/"
"ByJG\\WordProcess\\": "src/"
}
}
}
2 changes: 1 addition & 1 deletion exemplos.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'vendor/autoload.php';

$fonema = new \ByJG\FonemaBR();
$fonema = new \ByJG\BR\FonemaBR();

$lista = [
"ambulancia",
Expand Down
57 changes: 30 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false"
syntaxCheck = "false"
bootstrap = "vendor/autoload.php">
<!-- see http://www.phpunit.de/wiki/Documentation -->
<phpunit bootstrap="./vendor/autoload.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">

<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On" />
<ini name="display_startup_errors" value="On" />
<ini name="error_reporting" value="E_ALL" />
</php>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

<logging>
<!--<log type="coverage-text" />-->
</logging>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

</phpunit>

0 comments on commit e56b364

Please sign in to comment.