Search Results

Search: Posts Made By: 1Brajesh
Forum: Programming 09-04-2017
2,849
Posted By apmcd47
I've never used numpy but it looks as though the...
I've never used numpy but it looks as though the ravel function is flattening an n-dimensional array into a 1D array such that
p = [ [a, b, c] [d, e, f] [g, h, i] ]
p.ravel()
[ a, b, c, d, e, f,...
1,699
Posted By durden_tyler
This line: char_to_ix = { ch:i for i,ch in...
This line:

char_to_ix = { ch:i for i,ch in enumerate(chars) }
creates a Dictionary called "char_to_ix" that has for its keys, each character from the list "chars". The corresponding values are...
1,699
Posted By apmcd47
Further to the above post, the last two lines use...
Further to the above post, the last two lines use a python feature called list comprehension. I suggest you look that up in the Python documentation.

Andrew
5,562
Posted By drl
Hi. If you can use perl instead of awk, see...
Hi.

If you can use perl instead of awk, see thread https://www.unix.com/unix-desktop-dummies-questions-answers/207865-normalizing-files-sentence-count.html post 6.

Best wishes ... cheers, drl
5,562
Posted By Don Cragun
It's not just Mr.. It's also Mrs., Ms., Dr.,...
It's not just Mr.. It's also Mrs., Ms., Dr., Sr., Jr., and hundreds of other abbreviations. And these abbreviations don't always appear at the start of a sentence. (Or maybe you thought that the...
5,562
Posted By Don Cragun
If what you want to do is separate records at...
If what you want to do is separate records at points where the last character on a line is a <period>, <question-mark>, or <exclamation-point>, you probably want to use:
RS="[.?!]$"
as rdrtx1...
5,562
Posted By itkamaraj
why dont you just change Mr. to Mr# using sed...
why dont you just change Mr. to Mr# using sed command then pass the file to awk command. later.. change Mr# to Mr.

can you give the sample input file and expected output file

sed 's/Mr\./Mr#/g'...
5,562
Posted By ctac_
Hi, try RS="[^\"Mr.\"][.?!]"
Hi, try
RS="[^\"Mr.\"][.?!]"
5,562
Posted By rdrtx1
awk ' BEGIN { eol="[.?!;:]$" # There is a...
awk '
BEGIN {
eol="[.?!;:]$" # There is a problem with Mr. and Mrs.
maxWords=0
}

{
if (NF>maxWords) {
maxWords=NF
longestSentence = $0
}

for (i=1;i<=NF;i++) {...
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy