NLP // Create vector representation of words using 'count-based' model












0















So I know most people use prediction/regression models now like GloVe or word2vec, and creating vectors using the count-based model should actually be simpler, but I'm having a difficult time figuring it out (I think because I don't have much background in programming).



Basically, I want to create vector representations of English words, and I want to be able to set the dimensions for each vector (which will probably be something like the 2,000 most frequent words in whatever corpus I end up using). I also want to be able to set the window (for instance, look at x number of words before and after the target word).



What would be the best way to get started doing this (preferably using python)?










share|improve this question


















  • 1





    scikit-learn.org/stable/tutorial/text_analytics/…

    – min2bro
    Nov 26 '18 at 3:40











  • Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

    – Will
    Nov 26 '18 at 5:59






  • 1





    do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

    – AbtPst
    Nov 28 '18 at 19:49











  • @AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

    – Will
    Nov 29 '18 at 0:49











  • Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

    – Will
    Nov 29 '18 at 0:51
















0















So I know most people use prediction/regression models now like GloVe or word2vec, and creating vectors using the count-based model should actually be simpler, but I'm having a difficult time figuring it out (I think because I don't have much background in programming).



Basically, I want to create vector representations of English words, and I want to be able to set the dimensions for each vector (which will probably be something like the 2,000 most frequent words in whatever corpus I end up using). I also want to be able to set the window (for instance, look at x number of words before and after the target word).



What would be the best way to get started doing this (preferably using python)?










share|improve this question


















  • 1





    scikit-learn.org/stable/tutorial/text_analytics/…

    – min2bro
    Nov 26 '18 at 3:40











  • Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

    – Will
    Nov 26 '18 at 5:59






  • 1





    do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

    – AbtPst
    Nov 28 '18 at 19:49











  • @AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

    – Will
    Nov 29 '18 at 0:49











  • Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

    – Will
    Nov 29 '18 at 0:51














0












0








0








So I know most people use prediction/regression models now like GloVe or word2vec, and creating vectors using the count-based model should actually be simpler, but I'm having a difficult time figuring it out (I think because I don't have much background in programming).



Basically, I want to create vector representations of English words, and I want to be able to set the dimensions for each vector (which will probably be something like the 2,000 most frequent words in whatever corpus I end up using). I also want to be able to set the window (for instance, look at x number of words before and after the target word).



What would be the best way to get started doing this (preferably using python)?










share|improve this question














So I know most people use prediction/regression models now like GloVe or word2vec, and creating vectors using the count-based model should actually be simpler, but I'm having a difficult time figuring it out (I think because I don't have much background in programming).



Basically, I want to create vector representations of English words, and I want to be able to set the dimensions for each vector (which will probably be something like the 2,000 most frequent words in whatever corpus I end up using). I also want to be able to set the window (for instance, look at x number of words before and after the target word).



What would be the best way to get started doing this (preferably using python)?







python vector nlp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 '18 at 3:06









WillWill

245




245








  • 1





    scikit-learn.org/stable/tutorial/text_analytics/…

    – min2bro
    Nov 26 '18 at 3:40











  • Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

    – Will
    Nov 26 '18 at 5:59






  • 1





    do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

    – AbtPst
    Nov 28 '18 at 19:49











  • @AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

    – Will
    Nov 29 '18 at 0:49











  • Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

    – Will
    Nov 29 '18 at 0:51














  • 1





    scikit-learn.org/stable/tutorial/text_analytics/…

    – min2bro
    Nov 26 '18 at 3:40











  • Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

    – Will
    Nov 26 '18 at 5:59






  • 1





    do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

    – AbtPst
    Nov 28 '18 at 19:49











  • @AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

    – Will
    Nov 29 '18 at 0:49











  • Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

    – Will
    Nov 29 '18 at 0:51








1




1





scikit-learn.org/stable/tutorial/text_analytics/…

– min2bro
Nov 26 '18 at 3:40





scikit-learn.org/stable/tutorial/text_analytics/…

– min2bro
Nov 26 '18 at 3:40













Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

– Will
Nov 26 '18 at 5:59





Thanks. Maybe I'm too dense, but I can't figure out from this how I would set up the dimensions for the vectors or set up the window

– Will
Nov 26 '18 at 5:59




1




1





do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

– AbtPst
Nov 28 '18 at 19:49





do you just want to create an array/vector of word counts? when you say 'each vector', what does each mean? What should a vector represent for you?

– AbtPst
Nov 28 '18 at 19:49













@AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

– Will
Nov 29 '18 at 0:49





@AbtPst I want to download a corpus, find the 2,000 most frequent words (excluding stop words) and use those as the dimensions for the vector representations. Then I want to go through the same corpus, and select a window, say five words before each target word and five words after, and use the frequencies of how often each target word appears in the same window as a context word (one of the 2,000 most frequent). I want to use pointwise mutual info for weighting. So I want to end up with a txt file where each word is followed by 2,000 numbers, each representing one of those 2000

– Will
Nov 29 '18 at 0:49













Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

– Will
Nov 29 '18 at 0:51





Perhaps scikit-learn is the best way to do that, but I can't figure out how to set up a window or employ pointwise mutual infomation

– Will
Nov 29 '18 at 0:51












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474295%2fnlp-create-vector-representation-of-words-using-count-based-model%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474295%2fnlp-create-vector-representation-of-words-using-count-based-model%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Lallio

Futebolista

Jornalista