Jump to content

sug15

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by sug15

  1. Haha, yes, I hate that too. Are there any languages something like this might be particularly useful for? I get that it's sort of "meh, already kinda there" for most.
  2. I made a quick mockup to give you a better idea. But, I think you've pretty much answered the question, unless I didn't explain it very well. It would work sort of like Google instant, the results would just be loaded via AJAX. "More details" would go to PHP's doc.
  3. Ok, thanks guys. So essentially, it sounds like even though something could be made that was slightly easier to use, PHP's doc is still good enough that something like I propose would not be worth switching to. Are there any other languages this might be useful for that don't have a great doc like PHP? Python maybe?
  4. For PHP. The documentation could be better. Often I just want an example or a quick run through, and I don't want to have extra clutter. Probably more likely to be true for newcomers.
  5. Essentially, it would be a "quick" documentation. You enter a keyword, function, etc. and the relevant function pops up, gives a one-sentence explanation, and gives an example. Just a little idea I had. Would you find this useful? Is there anything that could make it more useful?
  6. I finally figured it out. The trick was to use createElement while the page was loading (in other words, before onload). This worked: document.createElement("testele"); window.onload = function() { document.getElementsByTagName("testele")[0].innerHTML = 'hi'; };
  7. I have the non-standard element <testele></testele> In every browser except IE, this bit of JavaScript will successfully change the content of the above element document.getElementsByTagName("testele")[0].innerHTML = 'hi'; However, if I change the <testele> to just a <span> (in the HTML and the JavaScript), it now successfully changes the content of the element in every browser, including IE. Is there any fix? I have searched around and tried a bunch to no avail. Thanks!
  8. Let's say I'm requesting a 5 megabyte data file with cURL. I want to echo it for the user as it gets downloaded with cURL. Is there any way to do this? I'm also just using cURL as an example, it could be file_get_contents(), or something else as well. Thanks!
  9. I actually have a thread asking a similar question: http://www.phpfreaks.com/forums/index.php/topic,295323.0.html Read that for some ideas.
  10. Yeah, that's a good idea, I was thinking about doing something like that. Then just split: ." .' !" !' ?" ?' . ! ? But anyone have an easy way/API to split sentences/determine valid sentence endings?
  11. Hey, I want to be able to extract each sentence from a block of text. I could just use either explode() or something like: preg_match_all("/(.+)\./Uism",$text,$match); $sentences = $match[0]; However, the problem is that this will also split abbreviations, for example, "The fox jumped over Mr. Smith's sheep." Would be split into 2 sentences. Does anyone know of a simple way to get past this? There's also abbreviations for middle initials, etc. It's not so simple, though, because 2 sentences could be "John is bigger than I. However, I am faster." Regardless if that is correct grammar or not, things like that could come up as an issue. I was thinking about just trying to identify abbreviations by matching any group of 5 letters or less without a vowel and ending in a period, and manually compiling a list of abbreviations that contain vowels or are over 5 letters and matching those. Then, I could determine name abbreviations, such as "John H." by checking to see if the word before single-letter words followed by a period begin with a capital letter. The above solution could work well, but it might run into issues, and is pretty complex. Anyone have an easier way or some code I could build off of? Or anyone know of an API? Thanks!
  12. Alright, I have been trying to work on this but it has been difficult. I looked at the Python NLTK but I don't think that will be of much help. Let's say I have a database full of facts, and one of them is "highway - a main road". The user enters a question, let's say "What is a highway?". I want to be able to pull the the answer from the database and then form it into proper English. For example, in this case, I would like it to form "A highway is a main road". Let's say the user asks "what are highways. It should answer "Highways are main stretches of road". Then I could get into more complex sentences as I gather more data, for example "What is the average distance of a highway in the United States?" wouldn't just be giving a definition. Yes, I know this is pretty complex, but does anyone know where I could start? I have the basics, obviously - break up a sentence, interpret the words, try and figure out what tense it is in and if it's plural, then figuring out what it's asking, and then of course generating an answer. I don't have much of an idea how to do this, though. If anyone could give me an idea of where to start that would be great. Thanks a lot.
  13. Alright, thanks. I figured it out, but I was was just wondering for an expiriment I was doing. I wasn't actually planning on generating them all
  14. Let's say I have an array: array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); And I want to generate all possible outcomes of the array that are 32 characters, yes I know this will be a huge list. For example it would generate: 00000000000000000000000000000000 00000000000000000000000000000001 all the way up to fffffffffffffffffffffffffffffffd ffffffffffffffffffffffffffffffff And after each time one is generated, echo it, or do something. I have tried to do this, and can only really do it by generating a random one after another, but obviously that's not the best way. Does anyone know how? Thanks.
  15. This looks interesting, ive been tinkering with a web search crawler for a little while now, this will give me a base to work off. Thanks! I'll play with this a little... but not sure if it helps yet. I'll see though.
  16. Can't you access shell with godaddy?
  17. Here's an interesting question. Let's say I want to have a bot go to a page like http://www.phpfreaks.com/tutorial/php-add-text-to-image and find the only "meaningful" part of a page. For example, it would be a bot-like program and parse out raw text like this: So something like that, without finding the location of an RSS feed on the page or similar. Anyone have an idea how to do it? I'm not really looking for a full solution just ideas. My idea right now is that you would have to look for blocks of text where there are small amounts of HTML tags, and/or find what would appear to be the "main part" of a page by somehow analyzing the CSS. Any suggestions? Sorry, I know this may be a confusing question.
  18. Alright, here's what I've come up with: <?php $words1 = str_word_count('does the dog jump over the lazy sheep or the spotted cow', 1); $sizeof = sizeof($words1); for ($k = 0; $k < $sizeof; ++$k) {//specifies offset for ($i = $k; $i < $sizeof; ++$i) { for ($j = $k; $j <= $i; ++$j) { $combination[] = $words1[$j]; } $combinations1[] = implode(' ', $combination); unset($combination); } } $words2 = str_word_count('the dog jumps over the lazy sheep', 1); $sizeof = sizeof($words2); for ($k = 0; $k < $sizeof; ++$k) {//specifies offset for ($i = $k; $i < $sizeof; ++$i) { for ($j = $k; $j <= $i; ++$j) { $combination[] = $words2[$j]; } $combinations2[] = implode(' ', $combination); unset($combination); } } $similarities = array_intersect( $combinations1, $combinations2 ); print_r($similarities); ?> I still need to add some functions and tidy it up a bit and get the longest sentence, but it gets the job done.
  19. Now I'm working on breaking up a string into all possible parts. For example "the dog jumps over the lazy sheep" would break into: the the dog jumps the dog jumps over the dog jumps over the the dog jumps over the lazy the dog jumps over the lazy sheep dog dog jumps dog jumps over dog jumps over the dog jumps over the lazy dog jumps over the lazy sheep jumps jumps over jumps over the jumps over the lazy jumps over the lazy sheep over over the over the lazy over the lazy sheep the the lazy the lazy sheep lazy lazy sheep sheep Long list and yes I want similar substrings but I think I can achieve that by modifying your methods. Then when I get the similarities I can find the one I want by simply checking which one is the longest. Anyone have a way to generate all possible word combinations?
  20. Thanks a lot everyone. I'll play around with array_intersect and the code you guys gave me and see what I come up with.
  21. Let's say I have two strings of text: "Does the dog jump over the lazy sheep or the spotted cow?" and "The dog jumps over the lazy sheep." I want to match the similarities in the two sentences, in this case it would be "over the lazy sheep". How can I do this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.