#!/usr/bin/env python
# encoding: utf-8
'''

@Author  : Zhsama
@Contact : a602693793@gmail.com 
@File    : 004.py(not spark)
@Time    : 2018/10/18 16:50
@software: PyCharm

'''
import re


class wordCount:
    def openFile(self, filename):
        with open(filename, encoding='utf8', mode='r') as f:
            article = f.read()
            return article

    def count(self, string):
        result = re.findall(r'[a-zA-Z]+(\'[a-zA-Z]+|\b)', string)
        print(len(result))


words = wordCount()
article = words.openFile('GitHub.txt')
words.count(article)
