Ngram Plugin error when generating unigrams/bigrams/trigrams

Hi,

I’d be grateful for any advice! I’ve installed the Ngram plugin and everything seems to be working up to the point when I try to generate unigrams/bigrams/trigrams. The items validate fine, the pool/corpus look correct, but I just get an error when I try to generate them. The button doesn’t grey out to show it’s working, the page just loads for a minute or so and goes straight to an error message. I’ve tried selecting a smaller corpus to test it (since there’s a lot of text in the corpus I want) but it still doesn’t work.

Does anyone have any advice? Is it likely to be a size issue? Is there a limit on the number of words the plugin can handle? Or might there be any characters in the text field that are causing errors? I can’t think of anything else…

Thank you!

What version of Omeka and Ngram plugin are you using? What error message are you getting?

Thanks for replying. It’s Omeka 3.0.2 and Ngram 1.2. It just says “Omeka has encountered an error”. I’ve turned on the error messages and nothing else comes up. I have the error log enabled but it’s not updating for this (it works, it records other things, but nothing for this…).

Would you mind posting a screenshot of the error? What are the item counts for your pool and corpus?

Pool count and corpus are both 244, but I also tried it with a much smaller corpus (12) and the same thing happens.

Here’s the screenshot:

The error log did record some issues as I was trying to sort this last night, but I don’t know if these are relating to the generating of the uni/bi/trigrams specifically, as I tried a few different things to fix it and might have been doing something else (I’m out of my depth here). But just in case this clarifies anything!

[16-Mar-2022 02:43:16 UTC] PHP Fatal error: Uncaught Error: Call to a member function getElementSet() on null in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/browse.php:30
Stack trace:
#0 /home/histor47/public_html/application/libraries/Omeka/View.php(114): include()
#1 /home/histor47/public_html/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run(’/home/histor47/…’)
#2 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render(NULL)
#3 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript(‘corpora/browse…’, NULL)
#4 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#5 /home/histor47/public_html/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#6 /home/histor47/pu in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/browse.php on line 30
[16-Mar-2022 02:43:30 UTC] PHP Fatal error: Uncaught Error: Call to a member function getElementSet() on null in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/browse.php:30
Stack trace:
#0 /home/histor47/public_html/application/libraries/Omeka/View.php(114): include()
#1 /home/histor47/public_html/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run(’/home/histor47/…’)
#2 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render(NULL)
#3 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript(‘corpora/browse…’, NULL)
#4 /home/histor47/public_html/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#5 /home/histor47/public_html/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#6 /home/histor47/pu in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/browse.php on line 30
[16-Mar-2022 02:50:34 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/show.php on line 22
[16-Mar-2022 02:50:45 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/histor47/public_html/plugins/Ngram/views/shared/corpora/show.php on line 22

Line 22 of show.php is:

<?php echo number_format(count($corpus->ItemsCorpus)); ?>

As I said, when I tried to replicate the problem today nothing goes into the error log, so I’m not sure any of the error log above relates to this.

I tried uninstalling and reinstalling the plugin…

If you follow these directions, you should see a more detailed message relating to the specific error.

Ah, I did, and it didn’t do anything unfortunately.

Try activating error logging.

Hi, as noted above I do have error logging enabled, but this error isn’t adding anything to the log (beyond what I quoted above).

The error log you posted from that shows those “PHP Fatal error” lines, that’s PHP’s error log.

Omeka has its own error log that stores in a different location (application/logs/errors.log within the Omeka folder) and is enabled by those linked instructions.

Any “Omeka has encountered an error” page should be logged in the Omeka error log.

Aha okay – sorry! I’ve got the right one now:

Looks like you need to set your PHP-CLI path: Setting the PHP Path - Omeka Classic User Manual

Thank you so much, I think it’s working now! (At least it says it’s generating the unigrams now) I really, really appreciate all the help!

1 Like