Last active
November 14, 2019 12:40
-
-
Save CUEICHI/557f477761ce73e539ac1f8a76755ed9 to your computer and use it in GitHub Desktop.
IIEEJ論文誌の投稿時のチェックリストから,用語チェック欄のNGワードを抽出する. python check.py src-dir で実行する.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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