Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodz committed May 14, 2024
1 parent 6454039 commit 093deec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
1 change: 0 additions & 1 deletion itn/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type Language struct {
}

func NewLanguageES() *Language {

l := &Language{
Multipliers: map[string]int{
"mil": 1000,
Expand Down
33 changes: 22 additions & 11 deletions itn/es_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,52 @@ func TestAlpha2Digit(t *testing.T) {
{
input: "treinta y cuatro = treinta cuatro",
output: "34 = 34",
}, {
},
{
input: "mas treinta y tres nueve sesenta cero seis doce veintiuno",
output: "+33 9 60 06 12 21",
},
{
input: "cero nueve sesenta cero seis doce veintiuno",
output: "09 60 06 12 21",
}, {
},
{
input: "cincuenta sesenta treinta y once",
output: "50 60 30 y 11",
}, {
},
{
input: "trece mil cero noventa",
output: "13000 090",
}, {
},
{
input: "cero",
output: "0",
}, {
},
{
input: "doce coma noventa y nueve, ciento veinte coma cero cinco, uno coma doscientos treinta y seis, uno coma dos tres seis.",
output: "12.99, 120.05, 1.236, 1.2 3 6.",
}, {
},
{
input: "coma quince",
output: "0.15",
}, {
},
{
input: "Tenemos mas veinte grados dentro y menos quince fuera.",
output: "Tenemos +20 grados dentro y -15 fuera.",
}, {
},
{
input: "Un momento por favor! treinta y un gatos. Uno dos tres cuatro!",
output: "Un momento por favor! 31 gatos. 1 2 3 4!",
}, {
},
{
input: "Ni uno. Uno uno. Treinta y uno",
output: "Ni uno. 1 1. 31",
}, {
},
{
input: "un millon",
output: "1000000",
}, {
},
{
input: "un millón",
output: "1000000",
},
Expand Down
2 changes: 0 additions & 2 deletions itn/parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (w *WordStreamValueParser) isCoefAppliable(coef int) bool {
}

func (w *WordStreamValueParser) push(word string, lookAhead string) bool {

log.Printf("+ WordStreamValueParser.push.word %s [ahead] %s [lastWord] %s", word, lookAhead, w.lastWord)

if word == "" {
Expand Down Expand Up @@ -234,7 +233,6 @@ func (w *WordToDigitParser) isAlone(word string, nextWord string) bool {
}

func (w *WordToDigitParser) push(word string, lookAhead string) bool {

if w.Closed || w.isAlone(word, lookAhead) {
log.Printf(">> WordToDigitParser.push.condition 0:[word]%s [ahead] %s [lastWord] %s", word, lookAhead, w.lastWord)
w.lastWord = word
Expand Down

0 comments on commit 093deec

Please sign in to comment.