@Mosrod/

WordAnalyzer

Python

Analyzes words/sentences/paragraphs

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.08403588341519219","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHRpbWUKCnByaW50KCIiIgogXyBfIF8gICAgICAgICAgIF8gX19fX18gICAgICAgICBfICAgICAgICAgICAgICAgICAKfCB8IHwgfF9fXyBfX18gX3wgfCAgXyAgfF9fXyBfX198IHxfIF8gX19fIF9fXyBfX18gCnwgfCB8IHwgLiB8ICBffCAuIHwgICAgIHwgICB8IC4nfCB8IHwgfC0gX3wgLV98ICBffAp8X19fX198X19ffF98IHxfX198X198X198X3xffF9fLHxffF8gIHxfX198X19ffF98ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxfX198ICAgICAgICAgICAgCiIiIikKCiMjIyBDQVBTIERFVEVDVElPTgoKdGltZS5zbGVlcCgyKQoKcHJpbnQoJ1xuXG5cblxuXG5cblxuXG4nKQoKd29yZCA9IGlucHV0KCdXb3JkOiAnKQoKCnByaW50KCIiIgotLS0KQ0hBUkFDVEVSIEFOQUxZU0lTIFNUQVRTOgoKIiIiKQoKCndvcmRkaWN0X2NsID0ge30KCgp3b3Jkc3BsaXRfY2wgPSB3b3JkLnNwbGl0KCcgJykKd29yZHNwYWNlc19jbCA9ICcnLmpvaW4od29yZHNwbGl0X2NsKQoKbGV0dHogPSBbXQoKZm9yIGkgaW4gcmFuZ2UobGVuKHdvcmRzcGFjZXNfY2wpKToKICB3c3BhY2UgPSB3b3Jkc3BhY2VzX2NsW2ldCiAgbGV0dHouYXBwZW5kKHdzcGFjZSkKCgojIENBUElUQUwKY2FwaXRhbCA9IDAKbG93ZXJjYXNlID0gMAoKaSA9IDAKCmZvciBpIGluIHJhbmdlKDAsIGxlbihsZXR0eikpOgogIHRfZmMgPSBzdHIobGV0dHpbaV0gaW4gJ0FCQ0RFRkdISUpLTE1OT1B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AgIDonLCBudW1iKQoKIyBTUEFDRVMKcHJpbnQoJ3NwYWNlcyAgICAgICAgICA6JywgbGVuKHdvcmQpLWxlbih3b3Jkc3BhY2VzKSkKCiMgV09SRCBBTU9VTlQKcHJpbnQoJ3dvcmQgYW1vdW50ICAgICA6JywgbGVuKHdvcmRzcGxpdCkpCgojIEVYQ0xVRElORyBTUEFDRVMKcHJpbnQoJ2xlbmd0aCAtIHNwYWNlcyA6JywgbGVuKHdvcmRzcGFjZXMpKQoKIyBJTkNMVURJTkcgU1BBQ0VTCnByaW50KCdsZW5ndGggKyBzcGFjZXMgOicsIGxlbih3b3JkKSkKCg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import time

print("""
 _ _ _           _ _____         _                 
| | | |___ ___ _| |  _  |___ ___| |_ _ ___ ___ ___ 
| | | | . |  _| . |     |   | .'| | | |- _| -_|  _|
|_____|___|_| |___|__|__|_|_|__,|_|_  |___|___|_|  
                                  |___|            
""")

### CAPS DETECTION

time.sleep(2)

print('\n\n\n\n\n\n\n\n')

word = input('Word: ')


print("""
---
CHARACTER ANALYSIS STATS:

""")


worddict_cl = {}


wordsplit_cl = word.split(' ')
wordspaces_cl = ''.join(wordsplit_cl)

lettz = []

for i in range(len(wordspaces_cl)):
  wspace = wordspaces_cl[i]
  lettz.append(wspace)


# CAPITAL
capital = 0
lowercase = 0

i = 0

for i in range(0, len(lettz)):
  t_fc = str(lettz[i] in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  t_fl = str(lettz[i] in 'abcdefghijklmnopqrstuvwxyz')
  
  if t_fc == 'True':
    capital += 1
    
  if t_fl == 'True':
    lowercase += 1




word = word.lower()
worddict = {}


wordsplit = word.split(' ')
wordspaces = ''.join(wordsplit)

for i in range(len(wordspaces)):
    wordi = wordspaces[i]
    if wordi in worddict:
        worddict[wordi] += 1
    else:
        worddict[wordi] = 1


for key, value in sorted(worddict.items()):
    print(key, ':', value)


vowels = ['a', 'e', 'i', 'o', 'u']
constants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']

vcdict = {'vowels': 0, 'constants': 0}

for key in sorted(worddict.keys()):
    if key in constants:
        vcdict['constants'] += worddict[key]
    if key in vowels:
        vcdict['vowels'] += worddict[key]


for key, value in sorted(vcdict.items()):
    if key == 'constants':
        cons = value
        print(key, '      :', value)
    if key == 'vowels':
        vows = value

print(key, '         :', value)

# CAPITAL 2

print('capital         :', capital)
print('lowercase       :', lowercase)


print('characters      :', cons + vows)

# PUNCTUATION

punctuation = ['.', ',', '"', '\'', '<', '>', '/', '!', '?', '@', '#', '%', '^', '&', '*', '(', ')', '-', '_', '+', '=', '{', '}', '[', ']', '|']

punct = 0

i = 0
for i in range(0, len(punctuation)):
    if worddict.get(str(punctuation[i])) is not None:
        punct += worddict[str(punctuation[i])]

print('punctuation     :', punct)

# NUMBERS
numb = 0

for i in range(0, 10):
    if worddict.get(str(i)) is not None:
        numb += worddict[str(i)]


print('numbers         :', numb)

# SPACES
print('spaces          :', len(word)-len(wordspaces))

# WORD AMOUNT
print('word amount     :', len(wordsplit))

# EXCLUDING SPACES
print('length - spaces :', len(wordspaces))

# INCLUDING SPACES
print('length + spaces :', len(word))