def __getRelevantPargaphsFromDecisions(self): featureTexts = [] otherTexts = [] for decision in self.__decisions: decisionText = DecisionModelProxy.GetTextFromDecision(decision) if decisionText: reasonsParagraphs = decisionText.Reasons.split('\n\n') paragraphsToRemove = set() numberOfParagraphs = len(reasonsParagraphs) for index in range(0, numberOfParagraphs): if self.__keyword in reasonsParagraphs[index]: featureTexts.append(reasonsParagraphs[index]) minIndex = max(0, index - self.__paragarphMargin) maxIndex = min(numberOfParagraphs, index + self.__paragarphMargin + 1) for removalIndex in range(minIndex, maxIndex): paragraphsToRemove.add(removalIndex) otherTexts += [ reasonsParagraphs[index] for index in range(0, numberOfParagraphs) if index not in paragraphsToRemove ] return ''.join(featureTexts), ' '.join(otherTexts)
def decisionFromCaseNumber(request, cn): """Renders a single decision.""" assert isinstance(request, HttpRequest) caseNumber = Formatters.formatCaseNumber(cn) decisions = DecisionModelProxy.GetDecisionListFromCaseNumber(caseNumber) viewModel = DecisionVM.DecisionViewModel(decisions) return render( request, 'app/decision.html', viewModel.Context, )
def analysed_decision(request, pk, analysername="restitutio"): assert isinstance(request, HttpRequest) from app.DBProxy import DecisionModelProxy decision = DecisionModelProxy.GetDecisionFromPrimaryKey(pk) viewModel = AnalysedDecisionViewModel(decision, analysername) return render( request, 'DecisionAnalyser/analyseddecision.html', viewModel.Context, )
def decision(request, pk, highlightterms='[]'): """Renders a single decision.""" assert isinstance(request, HttpRequest) from ast import literal_eval decisions = DecisionModelProxy.GetDecisionListFromPrimaryKey(pk) hlterms = literal_eval(highlightterms) viewModel = DecisionVM.DecisionViewModel(decisions, pk=pk, highlightterms=hlterms) return render( request, 'app/decision.html', viewModel.Context, )
def __getRelevantPargaphsFromDecisions(self): featureTexts = [] otherTexts = [] for decision in self.__decisions: decisionText = DecisionModelProxy.GetTextFromDecision(decision) if decisionText: reasonsParagraphs = decisionText.Reasons.split('\n\n') for paragraph in reasonsParagraphs: classification, probability = self.__baseclassifier.ClassifyText( paragraph) if classification == self.__keyword and probability > 0.70: featureTexts.append(paragraph) if classification != self.__keyword and probability > 0.80: otherTexts.append(paragraph) return ''.join(featureTexts), ' '.join(otherTexts)
def GetDecisions(self, classname): if classname.lower() == 'restitutio': decisionNumbers = ['T 0027/86', 'J 0026/88', 'T 0613/93', 'J 0008/91'] from app.DBProxy import DecisionModelProxy return [DecisionModelProxy.GetDecisionListFromCaseNumber(x) for x in decisionNumbers] return None
def __getDecisionsWithKeyordInKeywordsField(self): decisions = DecisionModelProxy.GetBibliographyFiltered( Keywords__contains=self.__keyword) return [x for x in decisions if x.DecisionLanguage == 'EN']
def __getDecisionsWithKeyordInKeywordsField(self): return DecisionModelProxy.GetBibliographyFiltered( Keywords__contains=self.__keyword)