There are 61 unique words in the text.

I count about 111 words here including three hyphenated, how many do you count and how many are unique?

 No person

 shall be

 a Senator or

 Representative in Congress, or

 elector of President and Vice President, or

 hold

any office, civil or military, under the United States, or

under any State, who, having previously taken an oath, as a

member of Congress, or as an officer of the United States,

or as a member of any State legislature, or as an executive

or judicial officer of any State, to support the Constitution

of the United States, shall have engaged in insurrection or

rebellion against the same, or given aid or comfort to the

enemies thereof. But Congress may by a vote of two-thirds

of each House, remove such disability


I'll start by removing the punctuation from the text you provided, except for hyphens. Then, I'll split the text into individual words, and count the total number of words and the number of unique words.


Python



import string

# Store the text
text = """No person shall be a Senator or Representative in Congress, or elector of President and Vice President, or hold
any office, civil or military, under the United States, or
under any State, who, having previously taken an oath, as a
member of Congress, or as an officer of the United States,
or as a member of any State legislature, or as an executive
or judicial officer of any State, to support the Constitution
of the United States, shall have engaged in insurrection or
rebellion against the same, or given aid or comfort to the
enemies thereof. But Congress may by a vote of two-thirds
of each House, remove such disability"""

# Remove punctuation except hyphens
cleaned_text = text.translate(str.maketrans('', '', string.punctuation.replace("-", "")))

# Split the text into words
words = cleaned_text.split()

# Count the total number of words
total_words = len(words)

# Count the number of unique words
unique_words = len(set(words))

# Print the results
print(f"Total words: {total_words}")
print(f"Unique words: {unique_words}")

Code output

Total words: 110
Unique words: 61


The text contains 110 words, including three hyphenated words. There are 61 unique words in the text.

Sources

1. https://ca.wikipedia.org/wiki/Catorzena_esmena_de_la_Constituci%C3%B3_dels_Estats_Units



Comments