richardjh Posted June 17, 2009 Share Posted June 17, 2009 Hope it's okay to post this question here: Would php be capable of text string manipulations such as on this site: http://www.autocrit.com/pages.php?pageid=59 moreover, would it be possible to create a grammar/syntax checker using php? thanks for your replies. R Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/ Share on other sites More sharing options...
richardjh Posted June 18, 2009 Author Share Posted June 18, 2009 Okay, maybe i should rephrase the question would it be possible to create a php script which could analyze, say, a paragraph of text and return a list of things such as word frequency, common word / unusual word / overused words (maybe using a dictionary via mysql). sentence length and so forth? I know php has many string manipulation functions but I'm wondering how clever one could be using php to analyze long strings. I think it would be possible to also create a php code snippet to analyze the pace of a block of text by getting it to count the sentences ( increment +1 at each full stop) and then by using a bit of math calculations work out if the block of text is fast or slow paced (maybe also using speech mark counts within the calculations). Anyone have a view on this? many thanks thanks R Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858737 Share on other sites More sharing options...
JonnoTheDev Posted June 18, 2009 Share Posted June 18, 2009 simple answer, yes. Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858738 Share on other sites More sharing options...
richardjh Posted June 18, 2009 Author Share Posted June 18, 2009 the autocrit site I linked to above - could this all be achieved using php Neil? thanks for the remarkably quick reply too Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858740 Share on other sites More sharing options...
joel24 Posted June 18, 2009 Share Posted June 18, 2009 the autocrit site you linked to was created using php. you'd just have to play around with some string functions http://us2.php.net/strings Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858743 Share on other sites More sharing options...
Adam Posted June 18, 2009 Share Posted June 18, 2009 It wouldn't be the most straight forward tool for you if you're thinking like this... count the sentences ( increment +1 at each full stop) What about strings such as "1.0"? Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858744 Share on other sites More sharing options...
joel24 Posted June 18, 2009 Share Posted June 18, 2009 It wouldn't be the most straight forward tool for you if you're thinking like this... count the sentences ( increment +1 at each full stop) What about strings such as "1.0"? he'd have to search for a fullstop followed by a space, or a new line? Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858754 Share on other sites More sharing options...
Adam Posted June 18, 2009 Share Posted June 18, 2009 Not to mention ! ? ... and a whole bunch of other possibilities. Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858762 Share on other sites More sharing options...
richardjh Posted June 18, 2009 Author Share Posted June 18, 2009 Well I'm thinking of creating something to analyze blocks of text such as short stories and chapters of books. For pace I thought that by counting the sentences in a block of text AND by working out how many short, long or average sentences (including in the calculation things such as dialogue - text within quotes) and other factors, the script should arrive at a figure which could give a guide on pace within that block of text. For instance lots of short sentences with few long/average sentences would indicate pace which is far too fast; or a block with only very long sentences would be far too slow etc. Obviously the maths and calculations for such a script would be complicated and have to take in quite a few factors but that's the gist. Quote Link to comment https://forums.phpfreaks.com/topic/162635-php-capabilities/#findComment-858763 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.