-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSentenceOrderer.py
35 lines (28 loc) · 1 KB
/
SentenceOrderer.py
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
import abc
from abc import abstractmethod
'''
This code contains the abstract class for SentenceOrderer.
'''
'''
This is an Abstract class that serves as a template for implementations for ordering sentences.
'''
class SentenceOrderer():
__metaclass__ = abc.ABCMeta
# abstract method that should be implemented by the subclass that extends this abstract class
@abstractmethod
def __init__(self):
pass
# abstract method that should be implemented by the subclass that extends this abstract class
@abstractmethod
def orderSentences(self, sentences, snippets, info_dict):
pass
# DEPRICATED method to tile sentences. Tiling should NOT be done withing ordering module
def tileSentences(self, sentences):
answer = ''
for sentence in sentences:
answer += sentence[0].upper()
answer += sentence[1:]
if answer[-1] not in ['.', '!', '?']:
answer += '.'
answer += ' '
return answer[:-1]