Skip to content

Phonetic PT-BR is a JAVA library to deal with phonetization of words in Portuguese-Brazil.

Notifications You must be signed in to change notification settings

ericobattisti/phonetic-pt-br

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Phonetic PT-BR

Phonetic PT-BR is a JAVA library to deal with phonetization of words in Portuguese-Brazil.

This solution can be used to improve the performance of database queries that use "LIKE".

Usage 1

The implementation below shows how to get the "phonetic text".

import br.com.ebr.phonetizer.PhonetizerBR

public class PhonetizerTest {

	public static void main(String[] args) {
	
		String code1 = phonetizerBR.fonetizar("Rafaela Calleri");
		String code2 = phonetizerBR.fonetizar("Raphaela Kaleri");
		String code3 = phonetizerBR.fonetizar("Rafaella Kalery");
		
		System.out.println(code1);
		System.out.println(code2);
		System.out.println(code3);
		
	}

}
Console output:
RAFAILA KALIRI
RAFAILA KALIRI
RAFAILA KALIRI

Usage 2

The implementation below shows how to get the "phonetic code".

import br.com.ebr.phonetizer.PhonetizerBR

public class PhonetizerTest {

	public static void main(String[] args) {
	
		String code1 = phonetizerBR.makePhoneticCode("Rafaela Calleri");
		String code2 = phonetizerBR.makePhoneticCode("Raphaela Kaleri");
		
		System.out.println(code1);
		System.out.println(code2);
		
	}

}
Console output:
e93baf6f76
e93baf6f76

Usage 3

The implementation below shows how to validate "phonetic text".

import br.com.ebr.phonetizer.PhonetizerBR

public class PhonetizerTest {

	public static void main(String[] args) {
	
		ArrayList<String> codes = phonetizerBR.makeAllPhoneticCodes("Rafaela Calleri França");

		String codeTest = phonetizerBR.makePhoneticCode("Raphaela Kaleri");

		System.out.println(codes);
		System.out.println(codeTest);
		System.out.println("Was the code found? " + codes.contains(codeTest));
		
	}

}
Console output:
[c5890ad79a, 24b2a597db, e93baf6f76, 5ca718e072, 223022b80d, 8159bd784e, 46e2c74fe9]
e93baf6f76
Was the code found? true

License

MIT

About

Phonetic PT-BR is a JAVA library to deal with phonetization of words in Portuguese-Brazil.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages