ierhon commited on
Commit
d47a409
1 Parent(s): cb2cacc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -4,12 +4,14 @@ import random
4
 
5
  endings = ['ый', 'ий', 'ая', 'яя', 'ое', 'ее', 'ые', 'ие', 'ому', 'ему', 'ой', 'ей', 'ых', 'их', 'ым', 'им', 'ого', 'его', 'ую', 'юю', 'ого', 'его']
6
 
 
 
 
 
7
  def gen(text):
8
  a = text
9
  count = random.randint(5, 15)
10
- _dataset = open("dataset.txt", "r").readlines()
11
  _a = list(set(a))
12
- __dataset = {el: {"content": i} for el, i in enumerate(_dataset)}
13
  dataset = ' '.join([i['content'].replace('\n', '') for i in __dataset.values() if any(ii in i['content'] for ii in _a)])
14
 
15
  if len(dataset.strip()) == 0:
 
4
 
5
  endings = ['ый', 'ий', 'ая', 'яя', 'ое', 'ее', 'ые', 'ие', 'ому', 'ему', 'ой', 'ей', 'ых', 'их', 'ым', 'им', 'ого', 'его', 'ую', 'юю', 'ого', 'его']
6
 
7
+ with open("dataset.txt", "r") as f:
8
+ _dataset = f.readlines()
9
+ __dataset = {el: {"content": i} for el, i in enumerate(_dataset)}
10
+
11
  def gen(text):
12
  a = text
13
  count = random.randint(5, 15)
 
14
  _a = list(set(a))
 
15
  dataset = ' '.join([i['content'].replace('\n', '') for i in __dataset.values() if any(ii in i['content'] for ii in _a)])
16
 
17
  if len(dataset.strip()) == 0: