Следуя моим комментариям, я полагаю, что ваша задача станет легче, если вы воспользуетесь библиотекой проверки орфографии, чтобы проверить, действительны ли слова на английском языке sh или нет.
Примерно так (с помощью enchant, например):
import enchant
from pprint import pprint
en_us = enchant.Dict("en_US")
text = '''
Fintech Bitcoin crowdfunding and cybersecurity fintech bitcoin crowdfunding and cybersecurity
monster has left earned total satoshi monstercoingame Bitcoin
Bitcoin TCH bitcoin btch
bitcoin iticoin SPPL BXsAJ
coindesk The latest Bitcoin Price Index USD pic twitter com aKk
Trends For Bitcoin Regulation ZKdFZS via CoinDeskpic twitter com KNKgFcdxYD
Now there Mike Tyson Bitcoin app theres mike tyson bitcoin app
BitcoinBet Positive and negative proofs blockchain audits Bitcoin Bitcoin via
The latest Bitcoin Price Index USD pic twitter com CivXlPj
Bitcoin price index pic twitter com xhQQ mbRIb
'''
phrases = text.split('\n')
print('BEFORE')
pprint(phrases)
for i, phrase in enumerate(phrases):
phrases[i] = ' '.join(w for w in phrase.split() if en_us.check(w))
print('AFTER')
pprint(phrases)
Приведенный выше код будет выглядеть примерно так:
BEFORE
['',
'Fintech Bitcoin crowdfunding and cybersecurity fintech bitcoin crowdfunding '
'and cybersecurity',
'monster has left earned total satoshi monstercoingame Bitcoin',
'Bitcoin TCH bitcoin btch',
'bitcoin iticoin SPPL BXsAJ',
'coindesk The latest Bitcoin Price Index USD pic twitter com aKk',
'Trends For Bitcoin Regulation ZKdFZS via CoinDeskpic twitter com KNKgFcdxYD',
'Now there Mike Tyson Bitcoin app theres mike tyson bitcoin app',
'BitcoinBet Positive and negative proofs blockchain audits Bitcoin Bitcoin '
'via',
'The latest Bitcoin Price Index USD pic twitter com CivXlPj',
'Bitcoin price index pic twitter com xhQQ mbRIb',
'']
AFTER
['',
'Bitcoin and bitcoin and',
'monster has left earned total Bitcoin',
'Bitcoin bitcoin',
'bitcoin',
'The latest Bitcoin Price Index pic twitter com',
'Trends For Bitcoin Regulation via twitter com',
'Now there Mike Tyson Bitcoin app mike bitcoin app',
'Positive and negative proofs audits Bitcoin Bitcoin via',
'The latest Bitcoin Price Index pic twitter com',
'Bitcoin price index pic twitter com',
'']
НО, как вы можете видеть, такие слова, как Fintech
, crowdfunding
и cybersecurity
(чтобы перечислить несколько) были помечены как недействительные в Engli sh, поэтому вам нужно будет настроить код под свои нужды.
Надеюсь, это поможет.
Обновление: чтобы добавить исключения слов в свою программу проверки орфографии, сделайте что-то вроде этого:
exceptions = [
'Fintech',
'crowdfunding',
'cybersecurity',
'fintech',
'crowdfunding',
'cybersecurity',
'satoshi',
'monstercoingame',
'TCH',
'coindesk',
'USD',
'CoinDeskpic',
'theres',
'tyson',
'BitcoinBet',
'blockchain',
'USD'
]
for word in exceptions:
# add word to personal dictionary
#en_us.add(word)
# or add word just for this session only
en_us.add_to_session(word)