Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Does anyone know of a lemmatizer in PHP? Or, at worst, some way to use a lemmatizer in another language (python NLTK, for instance?) in a PHP webapp?
I'm building a macro-etymological analyzer and I've encountered this issue where the etymological database doesn't contain conjugated words. A lemmatizer would correct this, I think, by giving me the word "say" when the dictionary can't find "said," and returning "good" when the dictionary can't find "better," etc.
Note: a stemmer wouldn't do the same thing as a lemmatizer.
Does this help?
http://tartarus.org/~martin/PorterStemmer/php.txt
It's a PHP5 implementation of the Porter Stemmer algorithm.
i googled this:
http://pastebin.com/WNvb2zB4
and this.
http://tartarus.org/~martin/PorterStemmer/php.txt
dunno if any of them works.
Isn't a https://github.com/heromantor/phpmorphy is what you looking for?
Lemmatisation is relatively more complicated as compare to stemming, that is why it's harder to find some ready and free solution.
I see nobody answered the sub question.
some way to use a lemmatizer in another language (python NLTK, for instance?) in a PHP webapp
The php has at least exec and calls alike. One can simply run any external script or app.
there are some "lemmatizers" in php that could be found in internet, but at a quick check these are turn to be are "stemmers".
Make sure, Stemming won't do for you. Make sure the solution you already have in mind in other language is a Lemmatizer.
I suspect all solution that close to this naming would be in C-like languages. In case those are Open source or provided as libs you could build them into PHP as an extension.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Well, I recently have been trying to come with code to create matrix in which word hunting can be done. I want the user to initialise rows, columns and of course give the words, it is too difficult to create such code/algorithm as the words can be placed vertically, horizontally or diagonally. I also tried google for such algorithms but without any luck. So, if anyone has an algorthm in mind or has written such PHP code, itll be really great if I can see that.
Thanks in Advance,
Nalin Bhardwaj
I am so sorry , I posted this question here, as suggested by one of the users, I googled a few different things online an dhave found a ruby file which has been built for the same purpose. And , if anybody would like to access it, they may check it out online at http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/298382 . And, now I have decided to use this algorithm itself to create such a PHP file. Thank you everybody, for suggestions
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've recently discovered that using references in PHP is generally (although not always) a bad idea from a memory management or performance point of view, because of Copy On Write and the way that variables are represented under the hood using zvals.
Can someone offer a fuller explanation? I have seen this link posted a few times on Stack Overflow: http://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html
I also found this reference, which goes into a bit more detail about zvals and how they work. It's in French though, although Google does a pretty good job of translating it: http://julien-pauli.developpez.com/tutoriels/php/internals/variables/
I'm surprised there isn't any more, or better documentation on this, and I wondered if any other Stack Overflow users have come across any clearer or more accessible documentation that I haven't been able to find?
Sara Golemon has an interesting article at http://blog.golemon.com/2007/01/youre-being-lied-to.html
The moral of the story
Assigning values by references when you don't need to ... is NOT a
case of you outsmarting the silly engine and gaining speed and
performance. It's the opposite, it's you TRYING to outsmart the engine
and failing, because the engine is already doing a better job than you
think.
And some background on zvals in general. But both these are a bit old. Not sure how much has changed over the years.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
if is not in PHP, is possible use some command line tools which convert PO file into some structured format e.g. XML or some other which I can simple process in PHP?
Update: As of 2018/05, the best options are:
https://github.com/oscarotero/Gettext
https://symfony.com/doc/current/components/translation.html
https://docs.zendframework.com/zend-i18n/translation/
See http://www.phptherightway.com#i18n_l10n_title
There are some:
https://github.com/jyxo/php/tree/master/Jyxo/Gettext
https://github.com/clinisbut/PHP-po-parser
http://code.google.com/p/php-po-parser/
http://pear.php.net/package/File_Gettext/redirected
http://drupalcode.org/project/drupal.git/tree/HEAD:/core/lib/Drupal/Component/Gettext
The last one is part of Drupal, and it's probably the most maintained.
Some simple regular expressions will allow you to parse .PO/.POT files. I did a similar thing recently. Take the following regex from a script I have recently written:
$poMsgIdAndMsgStrRegex = '/^#\s*(.+?)\nmsgid "(.+?)"\nmsgstr "(.+?)"/m';
This does only capture the final comment line but it has so far been suitable for my purposes. You may need to adapt it.
Anyway, you can use the above regex with preg_match_all() to capture all MsgId and MsgStr strings into an array of matches. Once you have the array then you can put it into any format you wish.
There may be libraries for doing this but I have not seen any.
Edit: You may also want to check out the PHP class for converting.po files .mo format that is referred to in the 'possible duplicate' comment. It doesn't sound like it will solve your problem (since you want to convert .po files to XML), but it is worth examining anyway. It helped me a lot.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am using python with django. There I can simply make form from models and also it had builtin Admin.
I am eager to know corresponding framework for PHP with all this facilities.
I have encountered lot some similar questions like this, but they had not compared the frameworks with django. Experts Please Suggest.
I'd try Symfony.
What you're referring to sounds like "scaffolding"
I've had good success with Zend in the past. It has a lot of functionality in its libraries and it is all completely decoupled, so you can use whichever parts best fit your task, leaving out other things all together.
It doesn't have built in admin, but I like CodeIgniter. It really gives you freedom with your code without getting in the way.
I like Yii. It's based on the Model-View-Controller pattern, like most of the other PHP frameworks mentioned here. It uses templates, can do scaffolding, etc...
Another one that once saved my ass in a project with close deadline was CakePHP
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm pretty good with PHP, but the one thing I've never understood completely is classes. I've used a few (such as class.upload.php) but have fumbled my way around and more out of a monkey see monkey do approach.
Can anyone point me to some good tutorials that explain how these suckers work and how they function? I'd really appreciate it!
Thanks in advance
Nettuts: Object-Oriented PHP for beginners
That's a good startting point. They have a lot of these tutorials actually.
Also a good idea is, to just go to your bookstore, and see what's lying around there.
I still prefer actual paper to screen reading. Also makes it easier to annotate.
The rest will come with time.
After you understand the basics, it would be a good time to further read into OOP design patterns. Start with the singleton, as I feel like that is the easiest to grasp.
http://www.informit.com/articles/article.aspx?p=346958&seqNum=4
http://net.tutsplus.com/articles/general/a-beginners-guide-to-design-patterns/
Tutorials won't help you. I'm exactly where you are, but found out that tuts really don't tell you the why and what of things. Only the How.
I really recommend you buy a book. Prentice Hall PHP Power Programming is one excellent book.
www.php.net has awesome resources for these types of things:
http://php.net/manual/en/language.oop5.php