How to use the errant.edit.Edit function in errant

To help you get started, we’ve selected a few errant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chrisjbryant / errant / errant / alignment.py View on Github external
def get_all_merge_edits(self):
        edits = []
        for op, group in groupby(self.align_seq, 
                lambda x: True if x[0] == "M" else False):
            if not op:
                merged = self.merge_edits(list(group))
                edits.append(Edit(self.orig, self.cor, merged[0][1:]))
        return edits
github chrisjbryant / errant / errant / alignment.py View on Github external
def get_all_split_edits(self):
        edits = []
        for align in self.align_seq:
            if align[0] != "M": 
                edits.append(Edit(self.orig, self.cor, align[1:]))
        return edits
github chrisjbryant / errant / errant / en / merger.py View on Github external
# Split alignment into groups of M, T and rest. (T has a number after it)
    for op, group in groupby(alignment.align_seq, 
            lambda x: x[0][0] if x[0][0] in {"M", "T"} else False):
        group = list(group)
        # Ignore M
        if op == "M": continue
        # T is always split
        elif op == "T":
            for seq in group:
                edits.append(Edit(alignment.orig, alignment.cor, seq[1:]))
        # Process D, I and S subsequence
        else:
            processed = process_seq(group, alignment)
            # Turn the processed sequence into edits
            for seq in processed: 
                edits.append(Edit(alignment.orig, alignment.cor, seq[1:]))
    return edits
github chrisjbryant / errant / errant / alignment.py View on Github external
def get_all_equal_edits(self):
        edits = []
        for op, group in groupby(self.align_seq, lambda x: x[0]):
            if op != "M":
                merged = self.merge_edits(list(group))
                edits.append(Edit(self.orig, self.cor, merged[0][1:]))
        return edits

errant

The ERRor ANnotation Toolkit (ERRANT). Automatically extract and classify edits in parallel sentences.

MIT
Latest version published 9 months ago

Package Health Score

53 / 100
Full package analysis

Similar packages