<commit_before>from PyQt5 import QtWidgets
from .main_window_ui import Ui_MainWindow
from scrappy.parse.nltk_scraps import ScrapExtracter
from scrappy.document import Document

class MainWindow(QtWidgets.QMainWindow):
    """
    The main editor window.
    """

    def __init__(self):
        
        super(MainWindow, self).__init__()
        
        self._document = Document()
        self._scrapExtracter = ScrapExtracter()
        
        # set up UI using generated code from designer file
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        # handle save button click
        self.ui.actionSave.triggered.connect(self._update_document)
        
    def _update_document(self):
        """
        Add text in the editor to the document object.
        """
        self._document.parse_tree = self._scrapExtracter.extract_scraps(self.ui.textEdit.toPlainText())<commit_msg>make UI private to window<commit_after>from PyQt5 import QtWidgets
from .main_window_ui import Ui_MainWindow
from scrappy.parse.nltk_scraps import ScrapExtracter
from scrappy.document import Document

class MainWindow(QtWidgets.QMainWindow):
    """
    The main editor window.
    """

    def __init__(self):
        
        super(MainWindow, self).__init__()
        
        self._document = Document()
        self._scrapExtracter = ScrapExtracter()
        
        # set up UI using generated code from designer file
        self._ui = Ui_MainWindow()
        self._ui.setupUi(self)
        
        # handle save button click
        self._ui.actionSave.triggered.connect(self._update_document)
        
    def _update_document(self):
        """
        Add text in the editor to the document object.
        """
        self._document.parse_tree = self._scrapExtracter.extract_scraps(self._ui.textEdit.toPlainText())
{'fraction_non_alphanumeric': 0.08043478260869565, 'fraction_numerical': 0.0010869565217391304, 'mean_word_length': 2.5472061657032756, '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': '741316', 'n_tokens_mistral': 531, 'n_tokens_neox': 536, 'n_words': 123}