Skip to content

Commit

Permalink
glue apostrophes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronymous committed May 17, 2023
1 parent 4cea20a commit 008ed81
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions punctuation/recasepunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"""recasepunc file."""

import argparse
import collections
import os
import random
import sys
import unicodedata
import re

import numpy as np
import torch
Expand Down Expand Up @@ -201,6 +200,8 @@ def generate_predictions(config, line):
output += cased_token + punctuation_syms[punc_label]
if previous_label == 0:
output += '.'
# Glue apostrophes back to words
output = re.sub(r"(\w) *' *(\w)", r"\1'\2", output)
return output

mapped_punctuation = {
Expand Down

0 comments on commit 008ed81

Please sign in to comment.