Questions tagged [text-processing]

Mechanizing the creation or manipulation of electronic text.

Text processing includes basic processing jobs using filter, tokenization or normalization method to process text. This could be a pre-processing step for .

See also:

1959 questions
0
votes
1 answer

Python File Reading into another text in diff format

my text file look like name1\n name2\n name3\n I want read this file and store in another text file like this('name1','name2','name3') in Python, Could you please help anyone.
0
votes
1 answer

Analyzing and storing text in a data structure

I hope you understand what I want to do. It is hard to choose the best words, because English is not my first language and I distrust automatic translators. I will try to explain as well as I can. I was thinking about analyzing a long text. Suppose,…
Donovan
  • 6,002
  • 5
  • 41
  • 55
0
votes
3 answers

stripping the correct float value out of my string

I am using python to process pcap files and input the processed values to a text file. The text file has around 8000 rows and some times, the text file has string such as 7.70.582 . In my further processing of the text file i am splitting the file…
Ashish Kurian
  • 51
  • 5
  • 12
0
votes
1 answer

Linux: How to finish/interrupt the `less` command in "&" mode

Using Linux I want to know how to go back to normal file view with less whenever I used the & format in the less to search for only the lines with the pattern I am looking for. I know that I can typeq or ^z BUT these terminate the less.…
Daniel
  • 1,202
  • 2
  • 16
  • 25
0
votes
1 answer

Finding line duplicates in text file where lines can be identical to each other

I've made a system where the data in the database is filled when the system reads a file. This file may be filled at a later stage, which creates a demand to read the same file again. The data itself is represented on each line of the file, and the…
Awesome
  • 325
  • 3
  • 6
  • 14
0
votes
2 answers

Remove text after certain word

I have dynamic link build from variable : /Tinkle/Matte/BlackHyper/Black/Gunmetal How can I remove all text after variable value "BlackHyper" to become: "/Tinkle/Matte/BlackHyper" I try rtrim : $param="BlackHyper"; …
morowind
  • 302
  • 1
  • 9
  • 24
0
votes
2 answers

preg_replace multiline match but preserve new lines

I need a one liner that trims PHP from an HTML file. The trick is that I also need it to preserve the newlines previously taken up by the PHP lines. php -r "echo preg_replace('/<\\\\?.*(\\\\?>|\$)/Us','', file_get_contents(\$argv[1]));" --…
dafky2000
  • 74
  • 10
0
votes
3 answers

A cleaner way for multiple conditions in a list comprehension

I have a list of words which I want to clean based on certain criteria. For example, remove a word if: contains a dot contains a number contains certain noisy keywords (http, https in this case but can be extended) is equal to 's its length is less…
utengr
  • 3,225
  • 3
  • 29
  • 68
0
votes
4 answers

Merge two csv files if Id columns match

I have the following: file1.csv "Id","clientName1","clientName2" file2.csv "Id","Name1","Name2" I want to read file1 sequentially. For each record, I want to check if there is a matching Id in file2. There may be more than one match. For each…
Ken
  • 139
  • 12
0
votes
6 answers

How to delete parts of a file in python?

I have a file named a.txt which looks like this: I'm the first line I'm the second line. There may be more lines here. I'm below an empty line. I'm a line. More lines here. Now, I want to remove the contents above the empty…
wong2
  • 34,358
  • 48
  • 134
  • 179
0
votes
1 answer

NLP: How to get an exact number of sentences for a text summary using Gensim

I am trying to summarise some text using Gensim in python and want exactly 3 sentences in my summary. There doesn't seem to be an option to do this so I have done the following workaround: with open ('speeches//'+speech, "r") as myfile: …
Daniel Wyatt
  • 185
  • 1
  • 1
  • 12
0
votes
3 answers

parsing through file to print duplicate words and print on adjacent line - bash script

Example list: goodbye goodbye hello hi hi hi no Expected output: goodbye goodbye hello hi hi hi no I'd like to print the even the 'unlike' word as well, just on a separate individual line. But any matching on the same line.…
Mindy
  • 21
  • 3
0
votes
1 answer

Replacing pronouns throughout a String

I'm working on a project where I want to be able to be able to parse some text and find nouns and a lot of the text I want to parse has pronouns in it for Example => "Emma the parrot was a bird. She lived in a tall tree". I don't want to work with…
user7816390
0
votes
3 answers

How to find pattern inside a specific pattern and print both of them

I want to only print server name as header and whatever sas service is not up inside it.if everything is up inside server it should not be printed. File content- he2unix554 Server: SAS servers status: SAS OLAP Server 1 is UP SAS Object Spawner 1…
DGaynar
  • 1
  • 1
  • 2
0
votes
3 answers

Remove empty sections in markdown with bash

I'm looking for a way to remove empty sections in markdown documents, more specifically, changelogs. For example, if I have: ## Version ### Added - something ### Removed ### Changed - something ### Fixed I'd like to end up with: ##…
Nikola Knezevic
  • 789
  • 5
  • 20