6 ms·
Built this last week as part of the interview process for a job. I know it's flawed, but in my opinion neat nonetheless!
by alex_g 10y ago
Built this last week as part of the interview process for a job. I know it's flawed, but in my opinion neat nonetheless!
- blazespin 10y agoSuper super awesome, what a brilliant idea. You might want to do pattern matching such that the answer to the question doesn't match the text of the question. Your example image shows the immediate flaw there.
- alex_g 10y agoThanks, and good point. It's a very simple approach so there a numerous weaknesses that will be improved upon with a bit more knowledge of NLP.
- jdormit 10y agoDid you get the job?
- alex_g 10y agoAs far as I know they're still reviewing it.
- jdormit 10y agoGood luck!
- deleted 10y ago[deleted]
- bradgessler 10y agoGood luck! If it doesn't work out for any reason let me know if you're interested in Poll Everywhere.
- echelon 10y agoThey should have given you an offer... you clearly delivered. I bet you're going to get some offers from making this post on HN. Make sure you have your contact info in your profile. :)
- Cyph0n 10y agoExcellent idea. There are a lot of interesting ways to improve this, but you have an MVP running, which is a good start. Regarding your codebase: clear and to-the-point code, well commented, and helpful commit messages. Including a `requirements.txt` is a plus. Good job, keep it up!
- sAbakumoff 10y agoWell, I believe that any code should be readable enough so that the comments like below wouldn't be required. # splits a Wikipedia section into sentences # and then chunks/tokenizes each sentence If I had interviewed the author, I would have asked him what's the purpose of commenting like that.
- aldarn 10y agoI believe it's easier to read a native language than code. I would also counter there is no harm to comments like this so just because you don't find it useful doesn't mean someone else won't.
- sAbakumoff 10y agoOkay. My point is in that in the real job you don't have time for writing this type of comments. Instead you have your current task to work on, the issue that was re-opened and needs to be revisited, the bug to argue with QA about, the deadline to discuss with PM, the code-review to do ASAP. You simply don't have time to write the perfect code that is full of the comments in the "native language".
- yosamino 10y agoThis rather sounds like you don't have the time to not do it. Imagine using the time that spent on "re"-visiting "re"-opened bugs that are vague enough to be argued about on writing code that doesn't need these "re"s in the first place. I contend that that might be a difficult place to get to especially because it's a team effort as well, but I feel it's more productive and less stressful to work like that.
- tradersam 10y agoGood luck mate, this is a really cool little project.
- krashidov 10y agoAwesome work! How long did this take you?
- ViktorasM 10y agoNeat and simple implementation. Consider docstrings for describing methods, this tends to integrate with IDEs a lot better than comments.
- raverbashing 10y agoIt's a nice idea One potential improvement is to remove the common parts of answer and question (as in your Triumph example)
- lappet 10y agoVery cool. Can you please add more info or talk about how the grammar/parsing is set up?
- alex_g 10y agoSure! Take a look at: https://github.com/alexgreene/WikiQuiz/blob/master/python/Article.py#L31 https://github.com/alexgreene/WikiQuiz/blob/master/python/Ar... I used nltk (natural language toolkit), which takes care of most of the hard work. It tokenizes whatever text you pass it, and even assigns each word a part-of-speech (noun, adjective, etc). The grammar is where I tinkered the most. You can see I have 3 grammar rules set up (NUMBER, LOCATION, PROPER). nltk will go through the tokenized words and see if any sequences of words match any of the rules.If it finds a match it groups/chunks those words together into a phrase with the tag you've specified (ie. LOCATION). As for the rules themselves, they're very easy to write once you understand the syntax. For example, let's look at my PROPER rule, {<NNP|NNPS><NNP|NNPS>+} Everything in the {} is the rule. The tags inside of the <> are the parts-of-speech assigned by nltk. Translating the rule literally would be: match any sequence that has: [an NNP or an NNPS] followed by one or more of [an NNP or an NNPS]. In other words, any sequence of two or more NNP or NNPS words.
- lappet 10y agoThanks a lot for the explanation. NNP would be Noun-Noun-Phrase and NNPS would be Noun-Noun-Phrase-Sentence I believe? I will play around with the syntax more.