LR-POR / MorphoBr

Resources for morphological analysis of Portuguese
Apache License 2.0
24 stars 4 forks source link

trailing space after some entries #86

Closed leoalenc closed 3 years ago

leoalenc commented 3 years ago

@arademaker, por acaso, verificando a questão dos prefixos de tags SBJ_ versus SUBJ, descobri que muitas entradas têm um espaço extra no final:

grep -Eho "\+SUBJ.+*" verbs/*.dict | sort | uniq -c

12981 +SUBJF+1+PL 6227 +SUBJF+1+PL 12981 +SUBJF+1+SG 6227 +SUBJF+1+SG ...

grep -Eho "\+SUBJ[^[:space:]]+*" verbs/*.dict | sort | uniq -c

 19208 +SUBJF+1+PL
  19208 +SUBJF+1+SG
  19208 +SUBJF+2+PL
  19208 +SUBJF+2+SG

É algo no mínimo deselegante que talvez devêssemos corrigir.

arademaker commented 3 years ago

O :space: na regex também captura tabulação. Veja:

% grep "[[:space:]]" ~/Temp/teste.txt
1   2
1  2
1   2
ar@leme verbs % grep "\s" ~/Temp/teste.txt
1   2
1  2
1   2
ar@leme verbs % grep "[ ]" ~/Temp/teste.txt
1  2
1   2
ar@leme verbs % grep "[ ]$" ~/Temp/teste.txt
1   2

Para o arquivo de entrada aberto no Emacs com o whitespace-mode onde conseguimos ver espaços como pontos e tabulação com o símbolo >>.

image

See

ar@leme morpho-br % grep "[ ]$" nouns/*.dict
ar@leme morpho-br % grep "[ ]$" adjectives/*.dict
ar@leme morpho-br % grep "[ ]$" verbs/*.dict
ar@leme morpho-br % grep "[ ]$" adverbs/*.dict
ar@leme morpho-br % grep "[ ]" adverbs/*.dict
ar@leme morpho-br % grep "[ ]" verbs/*.dict
ar@leme morpho-br % grep "[ ]" nouns/*.dict
ar@leme morpho-br % grep "[ ]" adjectives/*.dict

Não temos espaços! apenas tabulações.