Skip to content

Instantly share code, notes, and snippets.

View zhangmozhi's full-sized avatar

Mozhi Zhang zhangmozhi

View GitHub Profile
@zhangmozhi
zhangmozhi / iternorm.py
Last active June 12, 2021 18:36
Code for "Are Girls Neko or Shōjo? Cross-Lingual Alignment of Non-Isomorphic Embeddings with Iterative Normalization"
"""Iterative Normalization"""
from argparse import ArgumentParser
import numpy as np
def load_embed(filename, max_vocab=-1):
words, embeds = [], []
with open(filename, 'r') as f:
next(f)
for line in f: