ritwik12 / Virtual-Assistant

A linux based Virtual assistant on Artificial Intelligence in C
GNU General Public License v3.0
128 stars 95 forks source link

code restructuring to handle categories in a unified method #67

Closed omerdagan84 closed 4 years ago

omerdagan84 commented 5 years ago

Hi first time contributing to this repository the pollowing PR is a refactoring PR - handles: https://github.com/ritwik12/Virtual-Assistant/issues/38 https://github.com/ritwik12/Virtual-Assistant/issues/35

I ran basic sanity testing - including all documented inputs

Hope this helps Dagan

ritwik12 commented 5 years ago

35 #38

ritwik12 commented 5 years ago

analysis.o:(.bss+0x0): multiple definition ofscores' main.o:(.bss+0x0): first defined here analysis.o:(.data+0x0): multiple definition of catagories_str' main.o:(.data+0x0): first defined here analysis.o:(.data+0x60): multiple definition ofclassifier' main.o:(.data+0x60): first defined here analysis.o:(.bss+0x40): multiple definition of split' main.o:(.bss+0x40): first defined here analysis.o:(.bss+0xa4): multiple definition oflen' main.o:(.bss+0xa4): first defined here email.o: In function b64_decode': email.c:(.text+0x270): multiple definition ofb64_decode' decode.o:decode.c:(.text+0x0): first defined here email.o: In function b64_decode_ex': email.c:(.text+0x29a): multiple definition ofb64_decode_ex' decode.o:decode.c:(.text+0x2a): first defined here init_config.o:(.bss+0x0): multiple definition of scores' main.o:(.bss+0x0): first defined here init_config.o:(.data+0x0): multiple definition ofcatagories_str' main.o:(.data+0x0): first defined here init_config.o:(.data+0x60): multiple definition of classifier' main.o:(.data+0x60): first defined here init_config.o:(.bss+0x40): multiple definition ofsplit' main.o:(.bss+0x40): first defined here init_config.o:(.bss+0xa4): multiple definition of len' main.o:(.bss+0xa4): first defined here requests.o:(.bss+0x0): multiple definition ofscores' main.o:(.bss+0x0): first defined here requests.o:(.data+0x0): multiple definition of catagories_str' main.o:(.data+0x0): first defined here requests.o:(.data+0x60): multiple definition ofclassifier' main.o:(.data+0x60): first defined here requests.o:(.bss+0x40): multiple definition of split' main.o:(.bss+0x40): first defined here requests.o:(.bss+0xa4): multiple definition oflen' main.o:(.bss+0xa4): first defined here response.o:(.bss+0x0): multiple definition of scores' main.o:(.bss+0x0): first defined here response.o:(.data+0x0): multiple definition ofcatagories_str' main.o:(.data+0x0): first defined here response.o:(.data+0x60): multiple definition of classifier' main.o:(.data+0x60): first defined here response.o:(.bss+0x40): multiple definition ofsplit' main.o:(.bss+0x40): first defined here response.o:(.bss+0xa4): multiple definition of len' main.o:(.bss+0xa4): first defined here ssl.o: In functionb64_decode': ssl.c:(.text+0x0): multiple definition of b64_decode' decode.o:decode.c:(.text+0x0): first defined here ssl.o: In functionb64_decode_ex': ssl.c:(.text+0x2a): multiple definition of b64_decode_ex' decode.o:decode.c:(.text+0x2a): first defined here ssl.o: In functionSMTP_request': ssl.c:(.text+0x3d4): multiple definition of SMTP_request' email.o:email.c:(.text+0x644): first defined here ssl.o: In functionget_ip_adress': ssl.c:(.text+0xb58): multiple definition of get_ip_adress' email.o:email.c:(.text+0xdc8): first defined here ssl.o: In functionconnect_to_server': ssl.c:(.text+0xbcf): multiple definition of connect_to_server' email.o:email.c:(.text+0xe3f): first defined here ssl.o: In functionssl_connect': ssl.c:(.text+0xc63): multiple definition of ssl_connect' email.o:email.c:(.text+0xed3): first defined here functions.o:(.bss+0x0): multiple definition ofscores' main.o:(.bss+0x0): first defined here functions.o:(.data+0x0): multiple definition of catagories_str' main.o:(.data+0x0): first defined here functions.o:(.data+0x60): multiple definition ofclassifier' main.o:(.data+0x60): first defined here functions.o:(.bss+0x40): multiple definition of split' main.o:(.bss+0x40): first defined here functions.o:(.bss+0xa4): multiple definition oflen' main.o:(.bss+0xa4): first defined here collect2: error: ld returned 1 exit status make: *** [hellomake] Error 1 [ritsharm@ritsharm-ld1 ~/git/Virtual-Assistant-upstream_PR]$ gcc main.c $(pkg-config --libs --cflags libcurl) -lssl -lcrypto -l json-c -std=gnu11 /tmp/cct4Oovm.o: In function main': main.c:(.text+0xa1): undefined reference toinit' main.c:(.text+0x109): undefined reference to get_user_input' main.c:(.text+0x118): undefined reference toanalyze' main.c:(.text+0x122): undefined reference to response' collect2: error: ld returned 1 exit status [ritsharm@ritsharm-ld1 ~/git/Virtual-Assistant-upstream_PR]$ gcc main.c $(pkg-config --libs --cflags libcurl) -lssl -lcrypto -l json-c -std=gnu11 /tmp/cctbPC99.o: In functionmain': main.c:(.text+0xa1): undefined reference to init' main.c:(.text+0x109): undefined reference toget_user_input' main.c:(.text+0x118): undefined reference to analyze' main.c:(.text+0x122): undefined reference toresponse' `

omerdagan84 commented 5 years ago

sorry about that, this PR should not have included 'DONT PUSH EXPERIMENTAL' commit, was not aware that PRs keep tracking the branch

pushed a revert, this PR does not enable the Makefile yet - i still haven't figured it out, it will be a part of the next PR

ritwik12 commented 5 years ago

Cool, I will check, Thanks :)

ritwik12 commented 5 years ago

@omerdagan84 Tried your code, but the comparisons are not working, Try "find places to eat", it gives the response with email functionality where it should be restaurant functionality.

omerdagan84 commented 5 years ago

@ritwik12 correct, classification failure was due to hard-coded values separated by classifier used defined values to match the classifier array initialization pretty sure that should fix it

added benefit it allows arbitrary initialization of the classifier

ritwik12 commented 5 years ago

@omerdagan84 Also, as you are reconstructing code. Can you also sort files in separate directories hierarchy instead of lying in open outside.

omerdagan84 commented 5 years ago

@ritwik12 added comments and modified k,j variable names

as for file restructuring, I already have a working Makefile, but still have a few bugs I should be ready with a PR in a few days, let's discuss this under #50 I would like to get you opinion on how would you like the directory layout I would rather push the changes with the Makefile changes since part of the change is removing the #include "XXX.c" and moving to a function based layout, under the new layout it will be easier to change fle locations

ritwik12 commented 5 years ago

There are still v, i kind of variable names, please change

omerdagan84 commented 4 years ago

I think this PR can be merged, other issues should be opened and addressed in separate PRs I think it is best to keep each PR focused on one issue - in this PRs case - code refactoring logic issues should - most definitely - be addressed just not in this PR

ritwik12 commented 4 years ago

Sure, @omerdagan84 I hope every functionality is working fine. Will merge then

ritwik12 commented 4 years ago

All looks good, merging this now. Will add your name to the files where you have a major contribution.

ritwik12 commented 4 years ago

Thanks a lot for sending the PR, looking for more in future.

ritwik12 commented 3 years ago

@all-contributors please add @omerdagan84 for code

allcontributors[bot] commented 3 years ago

@ritwik12

I've put up a pull request to add @omerdagan84! :tada: