I don't know which of AI branch is will solve my problem [on hold]









up vote
-1
down vote

favorite












What should I use, machine learning, text analysis or pattern recognition if I have a set of words and I want to find a pattern between them and then look for this pattern in a long text?










share|improve this question







New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as primarily opinion-based by sascha, legoscia, Rob, GhostCat, mrpatg yesterday


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.














  • This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
    – jfaucett
    yesterday










  • thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
    – user6775268
    yesterday














up vote
-1
down vote

favorite












What should I use, machine learning, text analysis or pattern recognition if I have a set of words and I want to find a pattern between them and then look for this pattern in a long text?










share|improve this question







New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as primarily opinion-based by sascha, legoscia, Rob, GhostCat, mrpatg yesterday


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.














  • This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
    – jfaucett
    yesterday










  • thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
    – user6775268
    yesterday












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











What should I use, machine learning, text analysis or pattern recognition if I have a set of words and I want to find a pattern between them and then look for this pattern in a long text?










share|improve this question







New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











What should I use, machine learning, text analysis or pattern recognition if I have a set of words and I want to find a pattern between them and then look for this pattern in a long text?







database android-studio artificial-intelligence






share|improve this question







New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









user6775268

1




1




New contributor




user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user6775268 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as primarily opinion-based by sascha, legoscia, Rob, GhostCat, mrpatg yesterday


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.






put on hold as primarily opinion-based by sascha, legoscia, Rob, GhostCat, mrpatg yesterday


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.













  • This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
    – jfaucett
    yesterday










  • thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
    – user6775268
    yesterday
















  • This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
    – jfaucett
    yesterday










  • thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
    – user6775268
    yesterday















This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
– jfaucett
yesterday




This is a really vague question. It completely depends on what patterns you are looking for and what type of text. Could you define the problem more specifically? Perhaps, give some examples of what you mean, I think it will help greatly in getting an answer.
– jfaucett
yesterday












thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
– user6775268
yesterday




thanks for replay.. The idea is some English words have the same letters in them, like aim, aid, bail, bait ... etc and I’m not sure what to use to find the pattern between them which are the letters ai. After that whenever I would enter a text ( for example a book) it would find all the words that have (ai) in them
– user6775268
yesterday












1 Answer
1






active

oldest

votes

















up vote
0
down vote













I would build the n-grams of all the words.



from nltk import ngrams
from collections import Counter

words = ["aim", "aid", "bail", "bait"]


def build_ngrams(words, from_size, to_size):
word_ngrams =

for word in words:
for ngram_size in range(from_size, to_size + 1):
ng = ngrams(word, ngram_size)
word_ngrams.extend(ng)

return word_ngrams


# construct all bigrams and trigrams
word_ngrams = build_ngrams(words, 2, 3)

# find the most common n-grams
counter = Counter(word_ngrams)
print(counter.most_common(3))


This will give you the most common patterns, and you can use that later for your search.






share|improve this answer




















  • Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
    – user6775268
    yesterday










  • Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
    – jfaucett
    yesterday

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I would build the n-grams of all the words.



from nltk import ngrams
from collections import Counter

words = ["aim", "aid", "bail", "bait"]


def build_ngrams(words, from_size, to_size):
word_ngrams =

for word in words:
for ngram_size in range(from_size, to_size + 1):
ng = ngrams(word, ngram_size)
word_ngrams.extend(ng)

return word_ngrams


# construct all bigrams and trigrams
word_ngrams = build_ngrams(words, 2, 3)

# find the most common n-grams
counter = Counter(word_ngrams)
print(counter.most_common(3))


This will give you the most common patterns, and you can use that later for your search.






share|improve this answer




















  • Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
    – user6775268
    yesterday










  • Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
    – jfaucett
    yesterday














up vote
0
down vote













I would build the n-grams of all the words.



from nltk import ngrams
from collections import Counter

words = ["aim", "aid", "bail", "bait"]


def build_ngrams(words, from_size, to_size):
word_ngrams =

for word in words:
for ngram_size in range(from_size, to_size + 1):
ng = ngrams(word, ngram_size)
word_ngrams.extend(ng)

return word_ngrams


# construct all bigrams and trigrams
word_ngrams = build_ngrams(words, 2, 3)

# find the most common n-grams
counter = Counter(word_ngrams)
print(counter.most_common(3))


This will give you the most common patterns, and you can use that later for your search.






share|improve this answer




















  • Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
    – user6775268
    yesterday










  • Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
    – jfaucett
    yesterday












up vote
0
down vote










up vote
0
down vote









I would build the n-grams of all the words.



from nltk import ngrams
from collections import Counter

words = ["aim", "aid", "bail", "bait"]


def build_ngrams(words, from_size, to_size):
word_ngrams =

for word in words:
for ngram_size in range(from_size, to_size + 1):
ng = ngrams(word, ngram_size)
word_ngrams.extend(ng)

return word_ngrams


# construct all bigrams and trigrams
word_ngrams = build_ngrams(words, 2, 3)

# find the most common n-grams
counter = Counter(word_ngrams)
print(counter.most_common(3))


This will give you the most common patterns, and you can use that later for your search.






share|improve this answer












I would build the n-grams of all the words.



from nltk import ngrams
from collections import Counter

words = ["aim", "aid", "bail", "bait"]


def build_ngrams(words, from_size, to_size):
word_ngrams =

for word in words:
for ngram_size in range(from_size, to_size + 1):
ng = ngrams(word, ngram_size)
word_ngrams.extend(ng)

return word_ngrams


# construct all bigrams and trigrams
word_ngrams = build_ngrams(words, 2, 3)

# find the most common n-grams
counter = Counter(word_ngrams)
print(counter.most_common(3))


This will give you the most common patterns, and you can use that later for your search.







share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









jfaucett

47339




47339











  • Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
    – user6775268
    yesterday










  • Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
    – jfaucett
    yesterday
















  • Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
    – user6775268
    yesterday










  • Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
    – jfaucett
    yesterday















Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
– user6775268
yesterday




Ok thanks !! I will try it. by the way, this is my first time to deal with python language, so maybe I will take some time to test the code. and thanks again for your answer. the last question, if I want to do something like this code in an android studio, can be or not?
– user6775268
yesterday












Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
– jfaucett
yesterday




Yea definitely writing your own ngram function is really easy. You just iterate over a sequence creating all the tuples of size N you want. Then you have all the tuples in a list and can frequency count them to get the most common.
– jfaucett
yesterday



這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3