Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Script Crashes processing a simple phrase #5

Open
LinuXperia opened this issue Jan 4, 2024 · 0 comments
Open

BUG: Script Crashes processing a simple phrase #5

LinuXperia opened this issue Jan 4, 2024 · 0 comments

Comments

@LinuXperia
Copy link

Hi.
I tried this phrase here with nai-php but the script crashes with error message.

The Bug and Crash can be reproduced
when using this phrase here instead the one in the example:
$sentence = "I'm extremely happy, I've been";

The Error Crash Message is:

PHP Warning: Array to string conversion in ./NaiPosTagger/src/PosTagging/PosParticiples.php on line 131
PHP Stack trace:
PHP 1. {main}() ./nai-pos-tagger.php:0
PHP 2. NaiPosTagger\Pipelines\PipelinePosTagging->transform($sentence = 'I'm extremely happy, I've been') ./nai-pos-tagger.php:26
PHP 3. NaiPosTagger\Models\NaiDictionary::generateDictionary($sentence = 'ycqzlwprkejivbmndtgsahox I am extremely happy gifkucdmxrjslhwnazyqbvoe i have been ycqzlwprkejivbmndtgsahox') ./NaiPosTagger/src/Pipelines/PipelinePosTagging.php:83
PHP 4. NaiPosTagger\Models\NaiDictionary::posDictionary($pos_arr = [0 => [0 => [...]], 1 => [0 => [...]], 2 => [0 => [...]], 3 => [0 => [...]], 4 => [0 => [...]], 5 => [0 => [...]], 6 => [0 => [...]], 7 => [0 => [...]], 8 => [0 => [...]], 9 => [0 => [...]], 10 => [0 => [...]], 11 => [0 => [...]], 12 => [0 => [...]], 13 => [0 => [...]], 14 => [0 => [...]], 15 => [0 => [...]], 16 => [0 => [...]], 17 => [0 => [...]], 18 => [0 => [...]], 19 => [0 => [...]], 20 => [0 => [...]], 21 => [0 => [...]], 22 => [0 => [...]]]) ./NaiPosTagger/src/Models/NaiDictionary.php:77
PHP 5. NaiPosTagger\Models\NaiPosArr::identifyToken($pos_part = [0 => ['form' => 'been', 'lemma' => '', 'features' => '', 'sh-feat' => '', 'metadata' => [...], 'label' => '', 'rule' => '', 'pos_score' => 0]]) ./NaiPosTagger/src/Models/NaiDictionary.php:133
PHP 6. NaiPosTagger\PosTagging\PosParticiples::transformPartPast($pos_part = [0 => ['form' => 'been', 'lemma' => 'be', 'features' => 'VER:part+past+m+s', 'sh-feat' => 'VER', 'metadata' => [...], 'label' => '', 'rule' => '', 'pos_score' => 0]]) ./NaiPosTagger/src/Models/NaiPosArr.php:153
PHP 7. str_replace($search = '"VER"', $replace = '"ADJ"', $subject = ['ngs' => [305 => [...], 404 => [...]]]) ./NaiPosTagger/src/PosTagging/PosParticiples.php:131
PHP Fatal error: Uncaught TypeError: array_intersect_key(): Argument #1 ($array) must be of type array, string given in ./NaiPosTagger/src/PosTagging/PosNgrams.php:104
Stack trace:
#0 ./NaiPosTagger/src/PosTagging/PosNgrams.php(104): array_intersect_key()
#1 ./NaiPosTagger/src/PosTagging/PosNgrams.php(46): NaiPosTagger\PosTagging\PosNgrams::expandChangingNgrams()
#2 ./NaiPosTagger/src/Pipelines/PipelinePosTagging.php(269): NaiPosTagger\PosTagging\PosNgrams::transform()
#3 ./NaiPosTagger/src/Pipelines/PipelinePosTagging.php(87): NaiPosTagger\Pipelines\PipelinePosTagging->postOperations()
#4 ./nai-pos-tagger.php(26): NaiPosTagger\Pipelines\PipelinePosTagging->transform()
#5 {main}
thrown in ./NaiPosTagger/src/PosTagging/PosNgrams.php on line 104

With other phrase sentences it works but with this specific one it crashes.
What is exactly the problem and how can it be fixed ?
Thanks in advance for any helpful suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant