This file contains 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
SimpleDateFormat calendarFormatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); | |
Calendar now = Calendar.getInstance(); | |
String strFromCal = calendarFormatter.format(now); | |
Calendar calFromStr = Calendar.getInstance(); | |
try { | |
calFromStr.setTime(calendarFormatter.parse(strFromCal)); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} |
This file contains 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 sys | |
import unicodedata | |
table = {c: ' ' for c in range(sys.maxunicode) | |
if unicodedata.category(chr(c)).startswith('P')} | |
def remove_puntuation(s): | |
return s.translate(table) |
This file contains 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
# -*- coding: utf-8 -*- | |
import sys | |
import unicodedata | |
table = {c: u' ' for c in range(sys.maxunicode) | |
if unicodedata.category(unichr(c)).startswith('P')} | |
def remove_punctuation(s): | |
return s.translate(table) |
This file contains 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 re | |
sent = 'a b c b c c A B C B C C' | |
match = re.search('\w+', sent) | |
while match: | |
word = match.group() | |
sent, count = re.subn(word, '', sent, flags=re.I) | |
match = re.search('\w+', sent) | |
print(word, count) |
This file contains 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 click | |
@click.command() | |
def main(): | |
pass | |
if __name__ == "__main__": | |
main() |
This file contains 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
fig, ax = plt.subplots(nrows, ncols, figsize=(8, 8)) |
This file contains 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
wc = WordCloud(background_color="white", max_words=1000, | |
stopwords=STOPWORDS,width=1000,height=1000) | |
wc.generate(texts with space) | |
plt.imshow(wc) | |
plt.show() |
This file contains 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
plt.figure(figsize=(8, 8)) | |
plt.show() |
This file contains 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
from IPython.core.interactiveshell import InteractiveShell | |
InteractiveShell.ast_node_interactivity = "all" |
OlderNewer