quotes

R

Raghuramaiah Gompa

I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.

I know I can handle double quotes, but I am puzzled about
single quote as you can see they may occur two different
ways.

Please help. .. Raghu
 
U

usenet

Raghuramaiah said:
I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.

Sure, here you go:

#!/usr/bin/perl
use strict; use warnings;

print "I am \myquote{trying} to write a perl code to generate a\n",
"file with everybody{\justquote}s \singlequote{help}.\n"
__END__

If you decide you would like a better answer, try asking a better
question. For guidelines on how to ask a better question, please review
the posting guidelines for this group:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

Cheers!
 
P

Paul Lalli

Raghuramaiah said:
I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.

I know I can handle double quotes, but I am puzzled about
single quote as you can see they may occur two different
ways.


I don't have a clue what you're asking. Please post a
short-but-complete scritpt that demonstrates the problem you are
attempting to solve.

(Have you read the Posting Guidelines for this group?)

As a pure guess, you may wish to check out
http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common/delimited.pm

Paul Lalli
 
S

Scott Bryce

Raghuramaiah said:
I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.

use strict;
use warnings;

print qq(I am "trying" to write a perl code to generate a file with
everybody's 'help'.);
 
A

axel

Raghuramaiah Gompa said:
I am "trying" to write a perl code to generate a file
with everybody's 'help'.
The output should be:
I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.
I know I can handle double quotes, but I am puzzled about
single quote as you can see they may occur two different
ways.

I think you will have to look at the context of the single quotation
marks. For those in pairs enclosing a word or phrase, the first
quotation mark will in general not be immediately preceded by a
word character, but may well be preceded by a space, '(', and so
on. Similarly the second single quotation mark of a pair will in
general not be followed by a word character, but a space or '.' or
')' is very possible.

Axel
 
T

Tad McClellan

Raghuramaiah Gompa said:
I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:


What should the input be?

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.


Oh, the unlabeled paragraph at the beginning is supposed to be
the input I guess.

Why make us guess? Please be a bit more considerate of other
people's time.

Have you seen the Posting Guidelines that are posted here frequently?

I know I can handle double quotes, but I am puzzled about
single quote as you can see they may occur two different
ways.


Natural Language Processing is hard, but I'll give
it "the ol' college try" (my solution will fail on this very
sentence though, 'cause of the apostrophes).


--------------------
#!/usr/bin/perl
use warnings;
use strict;

$_ = q(I am "trying" to write a perl code to generate a file )
. q(with everybody's 'help'.);

s/ " ([^"]+) "/\\myquote{$1}/x;
s/\b ' \b /{\\justquote}/x;
s/ ' ([^']+) '/\\singlequote{$1}/x;

print "$_\n";
 
R

Raghuramaiah Gompa

I am "trying" to write a perl code to generate a file
with everybody's 'help'.

The output should be:

I am \myquote{trying} to write a perl code to generate a
file with everybody{\justquote}s \singlequote{help}.

I know I can handle double quotes, but I am puzzled about
single quote as you can see they may occur two different
ways.

Please help. .. Raghu

I do apologize for my incorrect posting. I do appreciate
your followup postings. Please forgive me.

My question should have been (more clearly) like this:

I want to develop and run a perl program on a file which
contains
single quotes, double quotes, and apostrophes. I want to
put each "sentence" (from the input file) under double
quotes under a macro like
\myquotes{sentence} (in the output file). This is not a
problem. But single
quotes pose a problem. Because things like `please
forgive me' should be transfered to \singlequote{please
forgive me}. Apostrophe in Raghu's mistake somehow
should be left alone (I know I asked a different thing
before, but I think this is what is needed). The later
type of apostrophe may occur several ways: you're aren't
...

Hope this is clear. Please help. .. Raghu
 
A

Anno Siegel

Raghuramaiah Gompa said:
I do apologize for my incorrect posting. I do appreciate
your followup postings. Please forgive me.

My question should have been (more clearly) like this:

I want to develop and run a perl program on a file which
contains
single quotes, double quotes, and apostrophes. I want to

....and other text, presumably.
put each "sentence" (from the input file) under double
quotes under a macro like
\myquotes{sentence} (in the output file). This is not a
problem. But single
quotes pose a problem. Because things like `please
forgive me' should be transfered to \singlequote{please
forgive me}. Apostrophe in Raghu's mistake somehow
should be left alone (I know I asked a different thing
before, but I think this is what is needed). The later
type of apostrophe may occur several ways: you're aren't
..

Hope this is clear. Please help. .. Raghu

Clear enough, but your question isn't about Perl, it's not even about
programming but about English. What are the possible uses of singular
single quotes in English text, and how can they be recognized?

I'm no expert, but I believe the central part of that would have to be
a data base of individual cases, along with very few general rules.
It will never be perfect, and you will have to balance the time to
invest in the data base against the perfection you want to achieve.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top