Find Jobs
Hire Freelancers

Tiny python script

$10 USD

Completed
Posted over 8 years ago

$10 USD

Paid on delivery
I need a simple script that parses a file and counts some occurrences of keyword. The file is very large (millions of lines) so the script should use readline for a file object or some other way, to avoid loading the whole file into memory all at once The file contents are sections, with a single title line and 1 or more lines under each section title section title lines (and only them) start with “@@@$” sample file contents: @@@$section_title_one apple strudel chocolate @@@$section title 2 ice cream pie @@@$another title some more lines the script should contain hardcoded a set of keywords, for developing it use kws = [“apple”,”banana”,”candy”] the script should count how many lines in each section contain 1 or more keywords. and print out the titles of all of the sections which have at least 5 occurrences, ordered descending by number of occurrences, in the following format [number of occurrences] - [section title] e.g. 25 - section_title_ten 23 - title of some other section .... the budget for this is $10, not more. with your bid, at the top of the private message, please indicate in how many hours from the time I accept your bid can you deliver this. thanks
Project ID: 9244052

About the project

25 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
HERE IS YOUR SOLUTION: Using python version 2.7 i would solve this like that: I can adjust my solution to another python version if you like #!/usr/bin/python2.7 from collections import OrderedDict # ADJUST FILE NAME HERE source_data_filename = "[login to view URL]" # ADJUST KEYWORDS HERE kws = ["apple", "banana", "candy"] res = {} with open(source_data_filename) as f: for line in f: if [login to view URL]("@@@$"): current = line[4:] current = [login to view URL]('\r\n') continue for kw in kws: if kw in line: [login to view URL](current, 0) res[current] += 1 result = OrderedDict(sorted([login to view URL](), key=lambda k: k[1], reverse=True)) for item in [login to view URL](): if item[1] > 4: print "%s - %s" % (item[1], item[0])
$10 USD in 0 day
5.0 (1 review)
0.0
0.0
25 freelancers are bidding on average $16 USD for this job
User Avatar
Hello! I can do this script for you in 40 minutes since my bid would be accepted. Please contact me if you are interested. Best regards.
$25 USD in 1 day
5.0 (21 reviews)
5.0
5.0
User Avatar
A proposal has not yet been provided
$15 USD in 1 day
5.0 (10 reviews)
4.4
4.4
User Avatar
@@@$ Hi, I am well equip to this kind of task, can handle it pretty well. In fact, I already done related to this job before. Let me know the best of your time so we can discuss further based on your requirements and we can move forward to the next step. Thanks, Joseph C Ocero
$10 USD in 0 day
4.8 (19 reviews)
4.8
4.8
User Avatar
A proposal has not yet been provided
$25 USD in 1 day
5.0 (21 reviews)
4.2
4.2
User Avatar
A proposal has not yet been provided
$34 USD in 1 day
4.7 (13 reviews)
4.0
4.0
User Avatar
A proposal has not yet been provided
$30 USD in 1 day
4.9 (12 reviews)
3.4
3.4
User Avatar
I can help you with your project, send me a sample file so I can check on it, it wont take much maybe 1-2 hours.
$15 USD in 0 day
4.9 (9 reviews)
3.4
3.4
User Avatar
1-Day Hi there! I'm a Professional Software developer and Data Analyst for a well known Software House in Islamabad named PacSquare Pvt Ltd. If I get this job, I assure you that you'll get my best services in return. Please consider my proposal, and discuss additional Info for this specific Project. Thanks for Reading! Best, Maher p.s. Budget is fixed, Please discuss if you agree. Thanks
$50 USD in 1 day
4.9 (8 reviews)
3.0
3.0
User Avatar
Hello, No. of hrs: 10 hrs. I am having 10+ yrs of experience in software programming with various technologies like c++, .net, python and Perl. With expertise in various phase of development, I believe i can provide you the required script with ease. Looking forward to hear back from you. Thanks. Sandip
$15 USD in 1 day
5.0 (2 reviews)
2.7
2.7
User Avatar
Hi, It will take at most 4 hours after hired for me to finish the task. Thanks
$11 USD in 1 day
5.0 (3 reviews)
1.9
1.9
User Avatar
Hello, I am very intrested to do this project for you. I am studing software engineering and I have couple of years expirience in this feild, so it wont take much time to do it. This is very important to me because this is my first project and I would like to have a positive review on start. As you can see my bid is pretty low, that is because I really need this first job on freelancer and I would be very grateful if you could help me with that. I will do my best to satisfy your every need. I can do it in 2-3 hours in total Looking forward to working with you. Update: Hello, I was free to finish my solution for your project. It would be great if you could look it up and let me know what do you think. I can send you part of my main code and if you like it i will send you the whole code immediately. Also, I have a suggestion. A code can be implement to ask from user to input keywords and then counts their occurrences. As i said, I am new on this site and I need an opportunity to prove myself. Thank you very much for understanding.
$10 USD in 1 day
5.0 (2 reviews)
1.2
1.2
User Avatar
Young proactive IT engineer that works with python everyday developing neural networks models in Python and Java.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Предложение еще не подано
$15 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Should be able to do this in less than an hour.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hey, I am very interesting in your project. I have years experience of python. i hope i could help you for this project. Thank you
$15 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
I already have the script written. It can be sent to you for completion of the project immediately once the bid is accepted.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hello Sir/Ma'am, Your script is ready... I used line by line file reading. so no memory wastage. Line number - title are stored in dictionary. Right now it prints on console.... but if you want in text file, let me know. Thank You..
$10 USD in 0 day
0.0 (0 reviews)
0.0
0.0
User Avatar
A proposal has not yet been provided
$15 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Can give flexibility to choose the headers. can give flexibility to choose number of occurrences. can give ability to use more then one file as input. can give ability to supply keywords as part of script or a different file. can complete in 5 hours from the time project is awarded (with out considering delay in viewing the decision)
$11 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hi, I have 4 years of experience in python. I can compete this script in 2 - 3 hrs. I have the alghorithm ready if you are interested. for loop: Read the file line by line. search for string'@@@$' for loop:read line and append to list till you find '@@@$' count the number of occurence of the keyword if: greater than 5 print output exit(this continues for all sections) Please let me know if we can work out it.
$10 USD in 0 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of ISRAEL
Netanya, Israel
5.0
67
Payment method verified
Member since May 19, 2007

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.