<commit_before>import kindred
from collections import OrderedDict,defaultdict

# Colors to use for output sentences with annotation
class bcolors:
	HEADER = '\033[95m'
	OKBLUE = '\033[94m'
	OKGREEN = '\033[92m'
	WARNING = '\033[93m'
	FAIL = '\033[91m'
	ENDC = '\033[0m'
	BOLD = '\033[1m'
	UNDERLINE = '\033[4m'

class RESPONSE:
	POSITIVE = 1
	NEGATIVE = 0
	ENTITYERROR = -1
		
	TABLE = {'y':POSITIVE,'n':NEGATIVE,'x':ENTITYERROR}


def manuallyAnnotate(corpus,candidateRelations):
	"""
	Provides a method for basic manual annotation of a series of candidate relations. Deals with a corpus, sentence by sentence, and prompts the user to annotate each candidate relation in turn. Can be exited before completion of the full list and the resulting annotations are split into an annotated corpus and unannotated corpus. Each document in the new corpora are individual sentences.
	
	:param corpus: Corpus of text for annotation
	:param candidateRelations: List of candidate relations (created using CandidateBuilder) to manually review and annotate
	:param corpus: kindred.Corpus
	:type candidateRelations: List of kindred.CandidateRelation
	:return: a tuple of an annotated corpus and unannotated corpus
	:rtype: two kindred.Corpus
	"""

	annotatedCorpus = kindred.Corpus()
	unannotatedCorpus = kindred.Corpus()

	options = OrderedDict()
	options['x'] = 'Done'
	options['0'] = 'None'

	print()
	print("For each sentence, choose an existing option or type the name of a new annotation")
	
	endAnnotation = False
	crCounter = 0
	#for sentence,crsInSentence in groupedBySentences.items():
	for doc in corpus.documents:
		docSentences = set(doc.sentences)
		crsInDoc = [ cr for cr in candidateRelations if cr.sentence in docSentences ]

		doc = kindred.Document(doc.text,doc.entities,[])

		if not endAnnotation:<commit_msg>Docstring mini fix<commit_after>import kindred
from collections import OrderedDict,defaultdict

# Colors to use for output sentences with annotation
class bcolors:
	HEADER = '\033[95m'
	OKBLUE = '\033[94m'
	OKGREEN = '\033[92m'
	WARNING = '\033[93m'
	FAIL = '\033[91m'
	ENDC = '\033[0m'
	BOLD = '\033[1m'
	UNDERLINE = '\033[4m'

class RESPONSE:
	POSITIVE = 1
	NEGATIVE = 0
	ENTITYERROR = -1
		
	TABLE = {'y':POSITIVE,'n':NEGATIVE,'x':ENTITYERROR}


def manuallyAnnotate(corpus,candidateRelations):
	"""
	Provides a method for basic manual annotation of a series of candidate relations. Deals with a corpus, sentence by sentence, and prompts the user to annotate each candidate relation in turn. Can be exited before completion of the full list and the resulting annotations are split into an annotated corpus and unannotated corpus. Each document in the new corpora are individual sentences.
	
	:param corpus: Corpus of text for annotation
	:param candidateRelations: List of candidate relations (created using CandidateBuilder) to manually review and annotate
	:type corpus: kindred.Corpus
	:type candidateRelations: List of kindred.CandidateRelation
	:return: a tuple of an annotated corpus and unannotated corpus
	:rtype: two kindred.Corpus
	"""

	annotatedCorpus = kindred.Corpus()
	unannotatedCorpus = kindred.Corpus()

	options = OrderedDict()
	options['x'] = 'Done'
	options['0'] = 'None'

	print()
	print("For each sentence, choose an existing option or type the name of a new annotation")
	
	endAnnotation = False
	crCounter = 0
	#for sentence,crsInSentence in groupedBySentences.items():
	for doc in corpus.documents:
		docSentences = set(doc.sentences)
		crsInDoc = [ cr for cr in candidateRelations if cr.sentence in docSentences ]

		doc = kindred.Document(doc.text,doc.entities,[])

		if not endAnnotation:
{'fraction_non_alphanumeric': 0.08745874587458746, 'fraction_numerical': 0.0231023102310231, 'mean_word_length': 4.837881219903692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7630186', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1103, 'n_words': 407}