You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The referenced line does not appear to work on my windows machine or my centOS7 server. The output from the command is empty. I've had to hack my version of this function to do this, and please don't mind the 'hackyness' as I'm not super fluent with the whole command line interactivity stuff.
Oh by the way I also added support for a dictionary file. The reasoning is that the site I'm using this for has lots of brand name stuff that comes up as misspellings so I wrote a script to weight every word on the site and created a hunspell dictionary file out of the big / common ones. It works well, though I didnt put a lot of thought into keeping the code neat and clean as I didn't really expect anyone to see this lol.
As to a run down of what I'm doing, is I'm loading the dictionary file into memory if it exists, Then I save it as a temp file with the $input var appended (not sure why anymore I did this a while back - however since I'm not providing the $Input var to the command line that must be related to the reason or is otherwise how hunspell is getting the $input). After that I create an empty temp file to dump the output of the shell command. After the command runs I get the output from the temp file, delete both files and return the output.
Do you approve of this? Do you want me to do a PR and clean it up or if you want to implement it your self that would be cool. I'd also be interested on your take as to why there is no output from the provided command. I think it has something to do with the path vars and my environment or something.
Obviously the dictionary file support would have to be added to the actual options rather than hard coded.
I ended up coming up with a much cleaner solution and it turns out that I dont even need the dictionary file with the latest codebase. I forked this, and fixed it up so it works on windows and bash but I'm not sure what shell you were doing this on. The way you were setting the environment was not working on my windows machine or my server. I'll submit a PR, but I recommend adding a condition for your shell back in for both the command method calls.
Also a side note, the findCommand and stemCommand functions could be merged to take a boolean $stems var that when set would just add a -s to the command. I could have done this but I forgot and I needed to get this up quick for a push to my code base.
HunspellPHP/src/HunspellPHP/Hunspell.php
Line 128 in 7c936c3
The referenced line does not appear to work on my windows machine or my centOS7 server. The output from the command is empty. I've had to hack my version of this function to do this, and please don't mind the 'hackyness' as I'm not super fluent with the whole command line interactivity stuff.
Oh by the way I also added support for a dictionary file. The reasoning is that the site I'm using this for has lots of brand name stuff that comes up as misspellings so I wrote a script to weight every word on the site and created a hunspell dictionary file out of the big / common ones. It works well, though I didnt put a lot of thought into keeping the code neat and clean as I didn't really expect anyone to see this lol.
As to a run down of what I'm doing, is I'm loading the dictionary file into memory if it exists, Then I save it as a temp file with the $input var appended (not sure why anymore I did this a while back - however since I'm not providing the $Input var to the command line that must be related to the reason or is otherwise how hunspell is getting the $input). After that I create an empty temp file to dump the output of the shell command. After the command runs I get the output from the temp file, delete both files and return the output.
Do you approve of this? Do you want me to do a PR and clean it up or if you want to implement it your self that would be cool. I'd also be interested on your take as to why there is no output from the provided command. I think it has something to do with the path vars and my environment or something.
Obviously the dictionary file support would have to be added to the actual options rather than hard coded.
` $dictionary_file = $_SERVER["DOCUMENT_ROOT"] . ".dictionary.txt";
The text was updated successfully, but these errors were encountered: