Skip to content

Instantly share code, notes, and snippets.

@CUEICHI
Last active November 14, 2019 12:40
Show Gist options
  • Select an option

  • Save CUEICHI/557f477761ce73e539ac1f8a76755ed9 to your computer and use it in GitHub Desktop.

Select an option

Save CUEICHI/557f477761ce73e539ac1f8a76755ed9 to your computer and use it in GitHub Desktop.
IIEEJ論文誌の投稿時のチェックリストから,用語チェック欄のNGワードを抽出する. python check.py src-dir で実行する.
import os,sys,re
ngword = [ '出来る','毎','表わす','行なう','の通り','言う','纏まった',
'分かる','時','等','見なす','予め','依らず','繋げる','先ず','尚',
'および','従って','又','且つ','即ち','又は','更に','とくに','如何に']
dir = sys.argv[1]
def chkfile(fname):
data = open(fname).readlines()
i = 0
for buf in data:
i+=1
for word in ngword:
if re.search(word,buf):
print(fname, ":",i,"@", word, ': ', buf)
def main():
if os.path.isfile(dir):
chkfile(dir)
else:
files = os.listdir(dir)
for f in files:
fname = dir + '/' + f
chkfile(fname)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment