Punctuation's are the marks, such as full stop, comma, and brackets, used in writing to separate sentences and their elements and to clarify meaning.
Questions tagged [punctuation]
451 questions
13
votes
1 answer
Python removing punctuation from unicode string except apostrophe
I found several topics of this and I found this solution:
sentence=re.sub(ur"[^\P{P}'|-]+",'',sentence)
This should remove every punctuation except ', the problem is it also strips everything else from the sentence.
Example:
>>> sentence="warhol's…

KameeCoding
- 693
- 2
- 9
- 27
11
votes
4 answers
Punctuation in LaTeX formulas
It seems to be common practice, when writing mathematics, to add punctuation to displayed formulas.
Is there any trick to avoid putting the punctuation mark inside the formula?
I want to avoid
Consider the function
\[ \sin(x).\]
I'd rather have…

Olivier Verdier
- 46,998
- 29
- 98
- 90
10
votes
4 answers
Removing punctuation marks form text in Scala - Spark
This is one sample of my data:
case time (especially it's purse), read manual care, follow care instructions make stays waterproof -- example, inspect rubber seals doors (especially battery/memory card door open time)
xm "life support" picture .…

Rozita
- 289
- 1
- 6
- 13
10
votes
3 answers
Which characters are included in the Lua punctuation string pattern (%p)?
I haven't been able to find documentation of which characters compound the punctuation set "%p" in Lua.

user3325563
- 187
- 2
- 12
9
votes
3 answers
Are there character collections for all international full stop punctuations?
I am trying to parse utf-8 strings into "bite sized" segments. For example, I would like to break down a text into "sentences".
Is there a comprehensive collection of characters (or regex) that correspond to end of sentences in all languages? I'm…

JDelage
- 13,036
- 23
- 78
- 112
9
votes
1 answer
Whitespace before some punctuation characters in French: is there a CSS way to avoid lines breaking?
For example, in this sentence, "Comment allez-vous ?", the question mark and the last word in the sentence are separated by a whitespace.
When French text is written in a column, you will often get something like this:
Elle zigzague pour empiéter…

Brachamul
- 1,886
- 2
- 21
- 34
9
votes
8 answers
How to remove punctuation in python?
I've a problem:
E.x. I have a sentence
s = "AAA? BBB. CCC!"
So, I do:
import string
table = str.maketrans('', '', string.punctuation)
s = [w.translate(table) for w in s]
And it's all right. My new sentence will be:
s = "AAA BBB CCC"
But, if I…

ctrlaltdel
- 145
- 1
- 2
- 7
9
votes
3 answers
Why is the hyphen conventional in symbol names in LISP?
What's the reason of this recommendation? Why not keeping consistent with other programming languages which use underscore instead?

Thomson
- 20,586
- 28
- 90
- 134
9
votes
5 answers
Join split words and punctuation with punctuation in the right place
So I tried using join() after splitting a string into words and punctuation but it joins the string with a space in between the word and punctuation.
b = ['Hello', ',', 'who', 'are', 'you', '?']
c = " ".join(b)
But that returns:
c = 'Hello , who…

user2270501
- 129
- 1
- 6
8
votes
11 answers
How do I add space between two variables after a print in Python
I'm fairly new to Python, so I'm trying my hand at some simple code. However, in one of the practices my code is supposed to display some numbers in inches on the left and the conversion of the numbers on the right;
count = 1
conv = count *…

Hebon
- 195
- 1
- 1
- 6
8
votes
2 answers
Preserve punctuations using unnest_tokens() in tidytext in R
I am using tidytext package in R to do n-gram analysis.
Since I analyze tweets, I would like to preserve @ and # to capture mentions, retweets, and hashtags. However, unnest_tokens function automatically removes all punctuations and convert text…

JungHwan Yang
- 181
- 2
- 5
8
votes
3 answers
How can I remove all leading and trailing punctuation?
I want to remove all the leading and trailing punctuation in a string. How can I do this?
Basically, I want to preserve punctuation in between words, and I need to remove all leading and trailing punctuation.
., @, _, &, /, - are allowed if…

user1618820
- 109
- 1
- 2
- 11
7
votes
5 answers
How to keep the delimiter while using RegEx?
I did a question about punctuation and regex, but it was confusing.
Supossing I have this text:
String text = "wor.d1, :word2. wo,rd3? word4!";
I'm doing this:
String parts[] = text.split(" ");
And I have this:
wor.d1, | :word2. | wor,d3? |…

Renato Dinhani
- 35,057
- 55
- 139
- 199
7
votes
3 answers
How to strip unicode "punctuation" from Python string
Here's the problem, I have a unicode string as input to a python sqlite query. The query failed ('like'). It turns out the string, 'FRANCE' doesn't have 6 characters, it has seven. And the seventh is . . . unicode U+FEFF, a zero-width no-break…

Dave Fultz
- 73
- 1
- 3
7
votes
2 answers
How to exactly remove the punctuation when using R with tm package
Update:
I think I may have a workaround to solve this problem, just to add one code :dtms = removeSparseTerms(dtm,0.1) It will remove the sparse character in the corpus. But I think this is ONLY a workaround, still wait for experts'…

Lisen
- 168
- 1
- 2
- 11