Jump to content

sug15

Members
  • Posts

    34
  • Joined

  • Last visited

Posts posted by sug15

  1. So it sounds/looks basically like what most IDE "auto-complete" features do. Not sayin' it's a bad idea, just saying it seems more like reinventing the wheel, not really seeing anything new or different from this. IOW between auto-completes from site search boxes or IDEs...this is kinda already covered...

     

    Also, it's only really useful as a quick guide for people who already know what they are looking for but fail at remembering details like argument orders. If someone knows there is probably a function out there that does what they want but can't quite describe it, they are likely going to be entering into a search bar a description of what they are trying to do. That makes the rest of the search results returned more useful.

     

     

    sidenote: I like auto-complete suggestion dropdowns for search boxes but fuck all i fucking HATE code auto-completers... I know a lot of people like it, especially since the "popups" do usually show syntax and descriptions etc.. but for me...it ends up hurting more than helping. Like for instance I use html-kit and I can't tell you how many times I've gone to make an opening php tag only to have html-kit decide I wanted an html p tag. /me shakes angry fist at auto-complete.

    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. Perhaps you should better illustrate/explain what your idea is, because I still fall back to my original statement in that it sounds like a regular site-search input field to me? Virtually every online doc has a search box somewhere...you enter in a function name and it lists results. Usually the actual manual entry is the first result returned if the user spelled it right and all that... so I'm not really sure what more you're bringing to the table here...

    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.

     

    o3wNhlV.png

  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. 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!

  5. 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!

  6. I don't think there is such a thing as an easy solution for this problem. The English language is rather complex even if everybody used it perfectly. To be able to cope with imperfect use is going to be an even more complex task. Even then I'm assuming you only wish to cope with English. Don't forget that a period is not the only valid character for ending a sentence, a question or exclamation mark are just as valid, as are perhaps other characters. Personally I think I might attempt to find and delimit exceptions with some kind of <ignore> tags, then use a simpler pattern for splitting (any valid char that's not between those tags), rather than writing a complex split pattern.

    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?

  7. 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!

  8. 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.

  9. 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.

  10. 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:

    One of the standard features of a message board is allowing members to have a signature, which is appended to the bottom of each post they make. Posters can put whatever they want into the signature (within forum settings). Putting quotes in one's signature is one of the more popular things to do

     

    ...etc..etc...

     

    On the other hand, there is a lot to explore and discuss about the specifics of captcha, so who knows, maybe I will. Until then,

     

    Happy Coding!

     

    Crayon Violent

     

    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.

  11. 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.

  12. 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 :P 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?

×
×
  • 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.