Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:18:11+00:00 2026-06-01T11:18:11+00:00

In python how can i develop this algorithm to find common patterns in a

  • 0

In python how can i develop this algorithm to find common patterns in a text which is in an array and say that these are the number of occurences of those items.

  For ex:
line_arr=""" :)hello hi there,My name is 'pixel' can i speak to 'Tom'
Hi, tom here :) 'pixel'
how are u doing today.
i just called to ask whats the cost of the microwae oven is it $50 or $60
it is $75
any d $iscounts on this..
10% to 30%"""

reg_dict={}
for l in line_arr:
    #find all common patterns and update it in an dictionary

Can we get all smileys,names in single quotes,currecncy starting with $ and percentages..Also if any more common things.and say we update this in a dictionary..Is this possible at all..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:18:13+00:00Added an answer on June 1, 2026 at 11:18 am

    What you have is a string, not an array. You should tokenize it first. Once you’ve done that, you can use collections.Counter.most_common:

    >>> from collections import Counter
    >>> import re
    >>> Counter(re.findall("\w+", line_arr)).most_common()[:5]
    [('is', 3), ('to', 3), ('pixel', 2), ('it', 2), ('i', 2)]
    

    If you want to find smileys, use a different tokenizer than the RE \w+ that I used above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to learn C++ so that i can develop C++ Python modules for
I want to develop an app with WXPython or other GUI for Python, can
I have develop a function in PYTHON that sends emails with one .doc attachment
I am trying to develop a simple python application that does not use a
We develop on Ubuntu/Macs and deploy RPMs to CentOS (this is the settings, can't
I develop python application which I decided to turn into package to be installed
I'm writing a python library that has a per-user configuration file that can be
i want to develop a website in Python. Can someone tell me how I
i am trying to develop an app which can allow me to share data
I want to develop a system that can track and follow a road. Initially,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.