These instructions are based on Mistobaan's gist but expanded and updated to work with the latest tensorflow OSX CUDA PR.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#연습문제 3\n", | |
"\n", | |
"###본 연습문제는 1주차 Neural Simulation 복습 및 function와 class 를 정의해보고 이를 활용해 보는 것을 목표으로 합니다.\n", | |
"\n", |
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 collections, math, random, numpy | |
import tensorflow as tf | |
from sklearn.cross_validation import train_test_split | |
sentences = """hated the movie it was stupid;\ni hated it so boring;\nawesome the movie was inspiring;\nhated it what a disaster;\nwe hated the movie they were idiotic;\nhe was stupid, hated her;\nstupid movie is boring;\ninspiring ourselves, awesome;\ninspiring me, brilliant;\nwe hated it they were rubbish;\nany inspiring movie is amazing;\nit was stupid what a disaster;\nits stupid, rubbish;\nstupid, idiotic!;\nawesome great movie;\nboring, must be hated;\nhe was boring the movie was stupid;\nboring movie was a disaster;\nboth boring and rubbish;\nso boring and idiotic;\ngreat to amazing;\ndisaster, more than hated;\nbetween disaster and stupid;\ndisaster, so boring;\nawesome movie, brilliant;\ntoo awesome she was amazing;\nhe was brilliant loved it;\ndisaster, only idiotic;\nrubbish movie hated him;\nit was rubbish, why so stupid?;\nrubbish, too boring;\nrubbish, disaster!;\nrubbish, very |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys,json,urllib | |
from pysrt import SubRipFile, SubRipItem | |
url_string = 'http://ajax.googleapis.com/ajax/services/language/' | |
def detect(text): | |
query = dict(v='1.0', q=text) |
Build TensorFlow 1.3 with SSE4.1/SSE4.2/AVX/AVX2/FMA and NVIDIA CUDA support on macOS Sierra 10.12 (updated October 5, 2017)
These instructions were inspired by Mistobaan's gist, ageitgey's gist, and mattiasarro's tutorial.
I always encountered the following warnings when running my scripts using the precompiled TensorFlow Python package:
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] Th
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 | |
class StringReplaceUtil(object): | |
""" | |
코퍼스와 같은 말뭉치에서 정해진 단위로 문장을 나누고, 한 문장에서 특정한 패턴이 있을 경우, 그 문장을 지우는 기능 | |
""" | |
def __init__(self, text: str, token_pattern: str): | |
""" |