GrapeNLP / pygrapenlp

Python package enabling the usage of the grapenlp-core library from Python
Other
2 stars 3 forks source link

Nonetype object has no attribute error #5

Open Shafi2016 opened 4 years ago

Shafi2016 commented 4 years ago

Hello, Thanks for the nice work, I am trying to replicate your example (at Kaggle) with my data and my grammar files. However at this chunk of code

`%%capture --no-display

For each relevant factor

tables_by_relevant_factor = {} for relevant_factor, papers in tqdm(papers_by_relevant_factor.items(), desc='Extracting: '): table = extract_from_text(papers, relevant_factors_grammar_engine) tables_by_relevant_factor[relevant_factor] = table`

I am getting the following error. Kindly assist. Thanks in advance!! image

javiersastre commented 4 years ago

Hi Shafi,The string_to_u_array function converts a Python string into a C++ Unicode array so it can be processed by GrapeNLP. You must make sure you pass a Python string. It seems you are passing a None value, which has no method "encode", therefore the error.Regards,JavierSent from my Samsung Galaxy smartphone. -------- Original message --------From: Shafi2016 notifications@github.com Date: 02/11/2020 00:19 (GMT+00:00) To: GrapeNLP/pygrapenlp pygrapenlp@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [GrapeNLP/pygrapenlp] Nonetype object has no attribute error (#5) Hello, Thanks for the nice work, I am trying to replicate your example (at Kaggle) with my data and my grammar files. However at this chunk of code %%capture --no-display For each relevant factor tables_by_relevant_factor = {} for relevant_factor, papers in tqdm(papers_by_relevant_factor.items(), desc='Extracting: '): table = extract_from_text(papers, relevant_factors_grammar_engine) tables_by_relevant_factor[relevant_factor] = table I am getting the following error. Kindly assist. Thanks in advance!!

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

Shafi2016 commented 4 years ago

Hello Javier,

Thanks for the instruction. I am getting another that .fst2 is not a UTF16-LE text file. Please let me know me how to correct this error.

Regards, Shafi

errror_fst2

javiersastre commented 4 years ago

Hi Shafi,

You need to convert the grammar GRF files into FST2 using the following Unitex command: Grf2fst2 axiom.grf -o grammar.fst2 If you use the Unitex graphical interface to do this operation (the cog button for compiling the grammar), Unitex creates an fst2 file that is not compatible with GrapeNLP. The Unitex commands are in the Unitex folder “App”. By default, when you install Unitex you don’t have the commands, only the user interface. You need to compile the commands from the source code, which is in Unitex folder “Src”. In the Unitex README.txt file it is explained how to do so. You go to Unitex folder

Src/unitex-core/build

and type

make install

Note you will need a C++ compiler (e.g. gcc) and the “make” tool. If you are in Linux or MacOS, that’s easy to install.

Regards,

Javier

From: Shafi2016 notifications@github.com Reply to: GrapeNLP/pygrapenlp reply@reply.github.com Date: Monday 2 November 2020 at 13:33 To: GrapeNLP/pygrapenlp pygrapenlp@noreply.github.com Cc: Javier Sastre javier.sastre@telefonica.net, Comment comment@noreply.github.com Subject: Re: [GrapeNLP/pygrapenlp] Nonetype object has no attribute error (#5)

Hello Javier,

Thanks for the instruction. I am getting another that .fst2 is not a UTF16-LE text file. Please let me know me how to correct this error.

Regards, Shafi

[Image removed by sender. errror_fst2]https://user-images.githubusercontent.com/56795978/97873485-b124ce80-1ce5-11eb-8473-f3bb9f7d5e4d.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/GrapeNLP/pygrapenlp/issues/5#issuecomment-720474261, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH5POLU7OJO3DD363MZ5AI3SN2YJ3ANCNFSM4TG23WUQ.

Shafi2016 commented 4 years ago

Thanks, Dr. Javier !!! Sorry for asking a basic question, I do not have a CS background and using this compiler first time.

I have gcc and "make" tools using MSYC. And I open, cd /c/ cd ‘C:/Program Files (x86)/Unitex-GramLab/Src/unitex-core/build’ and then type make install But I am getting error

./configure: eval: line 2276: syntax error near unexpected token (' ./configure: eval: line 2276:${SHELL} /c/Program Files (x86)/Unitex-GramLab/Src/unitex-core/build/tre-0.8.0/utils/missing --run true' make: *** [Makefile:1592: .libtre-done] Error 2

Thanks for your time!!!

Unitex-errro

javiersastre commented 4 years ago

Hi Shafi,

I see you are using a Windows machine. It’s a long time since I do not try to use Unitex or GrapeNLP on Windows, it would be much easier to install a Ubuntu Linux machine and work there. You could use VirtualBox to create the virtual machine:

https://www.virtualbox.org/wiki/Downloads

Then download a Ubuntu Desktop image and use it to create the virtual machine:

https://ubuntu.com/

Are you familiar with virtual machines and Linux?

Regards,

Javier

From: Shafi2016 notifications@github.com Reply to: GrapeNLP/pygrapenlp reply@reply.github.com Date: Friday 6 November 2020 at 16:01 To: GrapeNLP/pygrapenlp pygrapenlp@noreply.github.com Cc: Javier Sastre javier.sastre@telefonica.net, Comment comment@noreply.github.com Subject: Re: [GrapeNLP/pygrapenlp] Nonetype object has no attribute error (#5)

Thanks, Dr. Javier !!! Sorry for asking a basic question, I do not have a CS background and using this compiler first time.

I have gcc and "make" tools using MSYC. And I open, cd /c/ cd ‘C:/Program Files (x86)/Unitex-GramLab/Src/unitex-core/build’ and then type make install But I am getting error

./configure: eval: line 2276: syntax error near unexpected token (' ./configure: eval: line 2276: ${SHELL} /c/Program Files (x86)/Unitex-GramLab/Src/unitex-core/build/tre-0.8.0/utils/missing --run true' make: *** [Makefile:1592: .libtre-done] Error 2

Thanks for your time!!!

[Image removed by sender. Unitex-errro]https://user-images.githubusercontent.com/56795978/98386839-ad16ea80-201e-11eb-9fb5-428485317a10.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/GrapeNLP/pygrapenlp/issues/5#issuecomment-723158294, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH5POLSOOAKMWNA26E35BCDSOQMVXANCNFSM4TG23WUQ.

Shafi2016 commented 4 years ago

Thanks, Dr. Javier once again for your response! I have now installed a virtual machine and Ubuntu.

I moved to shafi@shafi-VirtualBox:~/Unitex-GramLab-3.2/Src/unitex-core/build$ make install

Everything seems to work fine until the end I get the following error. Is there any mistake I am making?

ErrorwithUbuntupg virtual machine and Ubuntu

javiersastre commented 2 years ago

It's been a while, not sure if this will be still useful to you, try Unitex 3.1, it doesn't give that error:

https://unitexgramlab.org/releases/3.1/