citiususc / Linguakit

Multilingual toolkit for NLP: dependency parser, PoS tagger, NERC, multiword extractor, sentiment analysis, etc.
GNU General Public License v3.0
64 stars 22 forks source link

Triples #9

Closed epetros closed 5 years ago

epetros commented 7 years ago

Greetings, I noted that the performance of the triples extractor in the demo website is much better than the one in the repo. Wondering why that is the case. Any chance we will soon have in the repo one that matches the online demo? Thanks.

gamallo commented 7 years ago

Oops. There is a serious bug in the new version of the dependency parser. We'll try to fix it ASAP. Thank you very much for your feedback. Meanwhile, you can use the former version of Linguakit: https://github.com/gamallo/Linguakit To run the triples extractor, the main script must be run as follows: ./linguakit en rel input.txt

epetros commented 7 years ago

Thank you. I will be waiting for the fix as well, cause I see through the demo website that there was a great improvement on this module from previous versions.

epetros commented 7 years ago

Greetings, I am sorry to report, but the triples extraction seem to have gotten worse after the parser fixes.

gamallo commented 7 years ago

Sorry for all these problems. I had copied the wrong parser. Now, we have updated the parser. Hope it works better now. The results wont' be identical to the demo version because in Linguakit.com the PoS tagger is Freeling 3.0. However, in the git repository, the PoS tagger is our own tool. Many thanks for your feedback!

epetros commented 7 years ago

It works better now. Thanks!

epetros commented 7 years ago

Greetings, I was wondering how can I use with Freeling instead like the demo version? Thanks

gamallo commented 7 years ago

Hi, If you're able to install freeling, go to the directory Linguakit and run the following pipe:

echo "Mary is eating fish." |analyze -f en.cfg |./scripts/AdapterFreeling-en.perl |./parser/parserDefault-en.perl -fa |./scripts/saidaCoNLL-fa.perl |./triples/triples_exe.perl

gamallo commented 7 years ago

Hi epetros, We have fixed new bugs in the parser. I think it works better now. All these bugs derive from the new version of Linguakit, which has been rewritten using more efficient coding.

epetros commented 7 years ago

Greetings, Thanks for all the good work. Unfortunately with the new fixes the triplets extractor is now many times mixing up subject, relation and object.

gamallo commented 7 years ago

Oups. Could you send me a phrase which is now wrongly analyzed while it was correct in the previous version? Many thanks.

epetros commented 7 years ago

Hi, am glad to help, here is an example: FRASE: "O João Alberto Manhica e a Maria Luisa foram antes de ontem buscar um livro na casa da Joana as 3 horas da madrugada"

Demo Website Sujeto Relación Objeto
O João Alberto Manhica e a Maria Luisa de buscar um livro
O João Alberto Manhica e a Maria Luisa de buscar um livro em a casa de a Joana

Old Linguakit Version SENTID_1 O João@Alberto@Manhica e a Maria@Luisa de buscar horas de a madrugada SENTID_1 O João@Alberto@Manhica e a Maria@Luisa de buscar horas de a mad rugada em a casa de a Joana

New Linguakit Version SENTID_1 casa de a Joana as 3 horas de a SENTID_1 O João@Alberto@Manhica e a Maria@Luisa

gamallo commented 7 years ago

Thanks a lot for your example! I've just uploaded a new version of Linguakit with a "better" version (I hope) of the Portuguese parser. In your example, there is a typo in "as 3 horas". It should be "às 3 horas". Now, the extraction of "O João Alberto Manhica e a Maria Luisa foram antes de ontem buscar um livro na casa da Joana às 3 horas da madrugada" is: SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro em a casa de a Joana SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro a as 3 horas de a madrugada

Please, send all the phrases you wish.

epetros commented 7 years ago

Greetings, I installed the new version, but unfortunately am unable to reproduce the triplets you mentioned above. For the frase: "O João Alberto Manhica e a Maria Luisa foram antes de ontem buscar um livro na casa da Joana às 3 horas da madrugada.", somehow I still get: SENTID_1 casa de a Joana a as 3 horas de a SENTID_1 O João@Alberto@Manhica e a Maria@Luisa

gamallo commented 7 years ago

Can you please run the following pipe? (just copy and paste in your command line)

echo "O João Alberto Manhica e a Maria Luisa foram antes de ontem buscar um livro na casa da Joana às 3 horas da madrugada." |./tagger/pt/sentences-pt_exe.perl |./tagger/pt/tokens-pt_exe.perl |./tagger/pt/splitter-pt_exe.perl |./tagger/pt/ner-pt_exe.perl |./tagger/pt/tagger-pt_exe.perl |./scripts/AdapterFreeling-pt.perl |./parsers/parserDefault-pt.perl -fa |./scripts/saidaCoNLL-fa.perl |./triples/triples_exe.perl

If it gives the same results I got, so the problem seems to be in configuration/installation requirements of your "deppattern.perl" command.

epetros commented 7 years ago

After running the command I still get the same result: SENTID_1 casa de a Joana a as 3 horas de a SENTID_1 O João@Alberto@Manhica e a Maria@Luisa

gamallo commented 7 years ago

So, the problem is in one of the modules. Please, can you run just the PoS tagger? echo "O João Alberto Manhica e a Maria Luisa foram antes de ontem buscar um livro na casa da Joana às 3 horas da madrugada." |./tagger/pt/sentences-pt_exe.perl |./tagger/pt/tokens-pt_exe.perl |./tagger/pt/splitter-pt_exe.perl |./tagger/pt/ner-pt_exe.perl |./tagger/pt/tagger-pt_exe.perl

The results I got are the following:

O o DA0MS0 João_Alberto_Manhica joão_alberto_manhica NP00000 e e CC a o DA0FS0 Maria_Luisa maria_luisa NP00000 foram ir VMIS3P0 antes antes RG de de SPS00 ontem ontem RG buscar buscar VMN03S0 um um DI0MS0 livro livro NCMS000 em em SPS00 a o DA0FS0 casa casa NCFS000 de de SPS00 a o DA0FS0 Joana joana NP00000 a a SPS00 as o DA0FP0 3 3 Z horas hora NCFP000 de de SPS00 a o DA0FS0 madrugada madrugada NCFS000 . . Fp

epetros commented 7 years ago

My results are quite different:

O o NP00000 João_Alberto_Manhica joão_alberto_manhica NP00000 e e VMI0000 a a NC00000 Maria_Luisa maria_luisa NP00000 foram foram VMI0000 antes antes NC00000 de de NC00000 ontem ontem VMI0000 buscar buscar UNK um um NC00000 livro livro NC00000 em em NC00000 a a NC00000 casa casa NC00000 de de NC00000 a a NC00000 Joana joana NP00000 a a VMI0000 as as NC00000 3 3 Z horas horas NC00000 de de NC00000 a a NC00000 madrugada madrugada VMP0000 . . Fp

gamallo commented 7 years ago

It seems that the problem is in the dictionary. The system is not using the Portuguese lexicon. Try to compile the lexicons like that:

./lexicon_compiler.perl

epetros commented 7 years ago

Great, now I can reproduce your results: SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro em a casa de a Joana SENTID_1 O João@Alberto@Manhica e a Maria@Luisa foram buscar um livro aa s 3 horas de a madrugada Thanks!

gamallo commented 7 years ago

:)

epetros commented 7 years ago

Was testing with a couple of docs....the new version is giving in many cases better results for information extraction (triplets) than the online demo now, at least for Portuguese. Good Job!

gamallo commented 7 years ago

Great. And thanks a lot for your feedback!

epetros commented 7 years ago
Greetings, The new version is definitely great, but I see it usually struggles with long term dependencies, ex: SENTENCE1: "Jean Barroca, especialista de Inovação e Tecnologias de Desenvolvimento do Banco Mundial, que falou da “Gestão de Dados do CMM”, valorizou, por sua vez, o Open Dataton." It finds no relation. Online Demo struggles as well to get the object: Sujeto Relación Objeto
Jean Barroca valorizou vez
Jean Barroca valorizou vez por sua

SENTENCE2:"A vítima foi atacada momentos depois de ter regressado ao rio por um crocodilo." SENTID_1 A vítima foi momentos SENTID_1 A vítima foi momentos de ter regressado a o rio por um crocodilo

Thanks

gamallo commented 7 years ago

Hi, Thanks to your example, I've found a bug in the new version struggling apposition. I've fixed it. The system works better now with long dependencies, even though it get stuck with many of them. Concerning the second example, I improved the rules for passive constructions. You can download the new version and thanks again for your valuable feedback.

epetros commented 7 years ago

Thank you.

epetros commented 7 years ago

Hi, If it's OK I will from time to time just post some sentence examples where it fails, maybe it can be of help for new versions:

SENTENCE1: "Um total de 29 funcionários, de diferentes unidades orgânicas do Ministério do Trabalho, Emprego e Segurança Social – MITESS, terminou quinta-feira, 21 de Setembro, em Lisboa, o 1º curso de Linguagem de Sinais."

Online Demo: Sujeto Relación Objeto
Um total de 29 funcionários terminou curso de Linguagem de Sinais

Git Version: SENTID_1 Um total de 29 funcionários – MITESS SENTID_1 Um total de 29 funcionários – MITESS de diferentes unidades orgânicas de o Ministério@de@o@Trabalho

SENTENCE2: "A Organização das Nações Unidas (ONU) acusou os militares do país de promoverem um limpeza étnica."

Online Demo:

Sujeto Relación Objeto
A Organização das Nações Unidas acusou os militares de o país
A Organização das Nações Unidas acusou os militares de o país de promoverem um limpeza étnica

Git Version: SENTID_1 A Organização@de@as@Nações@Unidas acusou os um limpeza étnica

SENTENCE3: "O carregamento de ajuda partiria para o norte de Rakhine, onde ataques de insurgentes rohingyas em 25 de agosto provocaram uma repressão militar."

Online Demo: Sujeto Relación Objeto
ataques de insurgentes rohingyas provocaram uma repressão militar
ataques de insurgentes rohingyas provocaram uma repressão militar em 25 de agosto
O carregamento de ajuda partiria para o norte de Rakhine

Git Version: SENTID_1 O carregamento de ajuda partiria para o norte de Rakhine

Thanks

gamallo commented 7 years ago

Oh yes, that's ok. Thanks!. Nice examples. I fixed a problem in the new version regarding dates and added some rules for appositions. Hope it works better now.

epetros commented 7 years ago

Greetings, Here is another example: SENTENCE: "Relatório da Agência Nacional de Águas mostra que 27% da população brasileira não tem acesso a tratamento e coleta de esgoto, e tampouco fossa séptica." SENTID_1 Relatório de a Agência@Nacional@de@Águas mostra que não ter@acesso a tratamento e coleta de esgoto. It fails to get the second relation. Overall its working much better now, thanks.

gamallo commented 7 years ago

Yes, I've just fixed a missing bracket within a rule concerning "que+clause" constructions. An updated version of Linguakit is now available. However, in order to get complex coordinated elements such as ", e tampouco fossa séptica", more rules are required. Thanks again!

epetros commented 7 years ago

Thanks.

epetros commented 7 years ago

Greetings, Two more examples: SENTENCE1: "O PRESIDENTE da República, inaugurou hoje a infra-estrutura que acolhe a partir de amanhã o XI Congresso do Partido."

SENTENCE2:"Gusttavo Lima oferece desconto a quem mostrar ingresso de show cancelado do Aerosmith em Curitiba."

gamallo commented 7 years ago

Hi, thanks again for your examples. Our grammar is very sensitive to agrammatical structures. The first sentence has two grammatical problems: the comma "," between the subject and the main verb is not expected by the grammar. On the other hand, in "a infra-estrutura" the article "a" is wrongly tagged as preposition by our PoS tagger, mainly because it does not know the category of "infra-estrutura" as it is not in the dictionary. The correct form is "infraestrutura". So, the results are better if the sentence is rewritten without agrammatical elements:

O PRESIDENTE da República inaugurou hoje a infraestrutura que acolhe a partir de amanhã o XI Congresso do Partido

In the second sentence, our grammar fails because it is not able to desambiguate the pp-attachment: "a quem mostrar..." is the Indirect Object of "oferecer", but our grammar interpret "a quem mostrar" as a relative clause depending on "desconto". I could make ad-hoc rules for this case, but I prefer make more serious changes in the future. By the way, I found some problems with relative clauses that have been fixed. Thanks!

epetros commented 7 years ago

Sounds good, thanks.

epetros commented 7 years ago

Hi, Another example, maybe it just fits the same mold of the previous one:

"A Assembleia Geral do Partido, em que se avaliou a conjuntura política e diversos aspectos pontuais de carácter nacional, teve o seu desfecho este domingo." Thanks

epetros commented 7 years ago

Hi, Just another example: "Os homens armados que travam batalha contra as forças governamentais no distrito da Mocímboa da Praia, na província de Cabo Delegado, desde a madrugada da passada quinta-feira (05), mataram um líder comunitário de uma povoação daquele ponto do país, na noite do último sábado (07)." Thanks

gamallo commented 7 years ago

Hi, Concerning the first example ("A Assembleia Geral do Partido, em que se avaliou a conjuntura política e diversos aspectos pontuais de carácter nacional, teve o seu desfecho este domingo.") the result is what I expected: SENTID_1 A Assembleia@Geral@de@o@Partido teve o seu desfecho

This output is not good at all, but "este domingo" is tagged as an adverbial phrase (verb modifier), and adverbials are not considered for making up triples. This is a conceptual problem that cannot be tackled easily.
On the other hand, the relative clause has not subject (it is impersonal), so no triple can be generated from this clause. This is also a conceptual issue with no easy solution.

Concerning your last example, I found a PoS tagged problem: "aquele" was wrongly tagged as pronoun. I fixed it an now the resulting triples are more informative:

SENTID_1 Os homens armados mataram um líder comunitário de uma povoação de aquele ponto de o país SENTID_1 Os homens armados mataram um líder comunitário de uma povoação de aquele ponto de o país desde a madrugada de a SENTID_1 Os homens armados mataram um líder comunitário de uma povoação de aquele ponto de o país em a noite de o último sábado SENTID_1 Os homens armados travam batalha SENTID_1 Os homens armados travam batalha contra as forças governamentais SENTID_1 Os homens armados travam batalha em o distrito de a Mocímboa@de@a@Praia

Thanks!

epetros commented 7 years ago

Good!

epetros commented 7 years ago

Greetings, Two more examples: Sentence 1: "O empreendimento, orçado em 20 milhões de dólares norte-americanos, será erguido durante os próximos 13 meses." Sentence 2: "Falando ontem, no acto de lançamento da primeira pedra desta fábrica, em Jacksonville, o Governador de Florida, Rick Scott, destacou a necessidade de envolvimento de todos na valorização do empreendimento que virá a catapultar o desenvolvimento da cidade. "

Thanks!

gamallo commented 7 years ago

The first example allowed me to find two bugs: one in the splitter and the other in the currency recognition function. They've been fixed and the system returns:

SENTID_1 O empreendimento será erguido SENTID_1 O empreendimento será erguido durante os próximos 13 meses

The second sentence is much more complex and the problems are both in the grammar and the PoS tagger. It considers that Rick Scott is the direct object of "Falando", and it classifies the preposition "a" in "virá a" as a personal pronoun. I can't fix them easily.

Thanks again!

epetros commented 7 years ago

I understand...thanks!

epetros commented 7 years ago

Hi! Another example: "Embora não soubesse falar muito bem, o Carlos que estudou com o Paulo, era um óptimo escritor."

gamallo commented 7 years ago

Nice example, thanks! There was a problem due to the use of commas. Now it is fixed: SENTID_1 o Carlos estudou com o Paulo SENTID_1 o Carlos era um óptimo escritor

However the subject dependency between "Carlos" and "não soubesse" is much more tricky to deal with.

epetros commented 7 years ago

Good, thanks. Natural language is very tricky indeed, wonder if you plan to make possible to capture these kind of tricky dependencies any time soon?

gamallo commented 7 years ago

Unfortunately, I just have time to fix easy problems. My plans are to rewrite the grammar using Universal Dependency criteria, but I don't know when I'll have time.

epetros commented 7 years ago

Ok, thanks.

epetros commented 7 years ago

Greetings, Another example: "Nomeação de Mugabe como embaixador da boa-vontade da OMS durou apenas três dias".

epetros commented 7 years ago

Hello, Is it feasible to make it less sensitive to commas placement? For example: "O CONSELHO Municipal da Cidade prevê, para o próximo ano, o arranque das obras do aterro sanitário de Jiba neste distrito." Introducing a comma before 'neste distrito', changes the triplet's output. "O CONSELHO Municipal da Cidade prevê, para o próximo ano, o arranque das obras do aterro sanitário de Jiba, neste distrito." Thanks

gamallo commented 7 years ago

Hi, I fixed the problems reported in the two last posts. Thanks for your help!

epetros commented 7 years ago

Great, thanks.

epetros commented 7 years ago

Hi, just one more example: " O Carlos estava cansado, por isso foi beber água." It does not get the second relation. Thanks