You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
2The only problem I foresee is that the probabilities will be vastly smaller than in your toy example. Given numerical instability, this means that soon all probabilities are 0. Using log odds solves this though. Furthermore, I’d use larger tokens (i.e. not characters but words/punctuation).Konrad Rudolph– Konrad Rudolph2011-06-28 15:20:18 +00:00Commented Jun 28, 2011 at 15:20
-
2@Konrad: the idea here isn't to test absolute probabilities: it's to test relative probabilities. For each line, is the text of that line more likely to have been generated by an English language model, or by a code language model.Ken Bloom– Ken Bloom2011-06-28 15:48:20 +00:00Commented Jun 28, 2011 at 15:48
-
5You can train this model on existing SO posts (particularly because you may need to account for Markdown syntax). If you assume that most posts are formatted correctly (or you pick through a large number of posts, on the order of tens of thousands, to remove posts that are not formatted correctly), then you assume that stuff that's not code formatted is English text, and stuff that is code formatted is code, you can train from actual SO answers.Ken Bloom– Ken Bloom2011-06-28 15:51:22 +00:00Commented Jun 28, 2011 at 15:51
-
1A tutorial about how to do this (using LingPipe in Java) is available from LingPipe's website. At the end of the tutorial, there are a number of papers on techniques to tackle this problem. I suggest reading them.Ken Bloom– Ken Bloom2011-06-28 16:04:31 +00:00Commented Jun 28, 2011 at 16:04
-
1It’s interesting to see that the state of the art solution has only a very low vote count, and rates vastly less than all those ad-hoc solutions which, admittedly, might just be good enough but rely a lot on special-casing and are inherently prone to overfitting.Konrad Rudolph– Konrad Rudolph2011-07-03 10:56:35 +00:00Commented Jul 3, 2011 at 10:56
|
Show 6 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you