scholarly360 commited on
Commit
08d63c1
·
verified ·
1 Parent(s): aafc36c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -16,6 +16,16 @@ from setfit import SetFitModel
16
  # Download from the 🤗 Hub
17
  clause_model = SetFitModel.from_pretrained("scholarly360/setfit-contracts-clauses")
18
 
 
 
 
 
 
 
 
 
 
 
19
  def util_upload_file_and_return_list_docs(uploaded_files):
20
  #util_del_cwd()
21
  list_docs = []
 
16
  # Download from the 🤗 Hub
17
  clause_model = SetFitModel.from_pretrained("scholarly360/setfit-contracts-clauses")
18
 
19
+
20
+ def split_into_sentences_with_offsets(text):
21
+ """
22
+ Splits a paragraph into sentences and returns them along with their start and end offsets.
23
+ :param text: The input text to be split into sentences.
24
+ :return: A list of tuples, each containing a sentence and its start and end offsets.
25
+ """
26
+ doc = nlp(text)
27
+ return [(sent.text, sent.start_char, sent.end_char) for sent in doc.sents]
28
+
29
  def util_upload_file_and_return_list_docs(uploaded_files):
30
  #util_del_cwd()
31
  list_docs = []