teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

修正

2018/04/26 09:43

投稿

James1201
James1201

スコア15

title CHANGED
File without changes
body CHANGED
@@ -51,7 +51,8 @@
51
51
 
52
52
  ---------------------------------------------------------------------------
53
53
  OSError Traceback (most recent call last)
54
+ <ipython-input-
54
- <ipython-input-88-171f9eae8e3f> in <module>()
55
+ 88-171f9eae8e3f> in <module>()
55
56
  6 path_wakati = path + ".wakati"
56
57
  7 if os.path.exists(path_wakati): continue
57
58
  ----> 8 text = open(path,"r").read()
@@ -59,4 +60,22 @@
59
60
  10 wt = " ".join(words)
60
61
 
61
62
  OSError: [Errno 22] Invalid argument
63
+ ```
64
+
65
+ ### エラー内容2
66
+ ```python
67
+ 0%| | 0/23 [00:00<?, ?it/s]
68
+ ./isojintext/eq_0312.txt
69
+
70
+ ---------------------------------------------------------------------------
71
+ OSError Traceback (most recent call last)
72
+ <ipython-input-25-15e4194c1e08> in <module>()
73
+ 7 if os.path.exists(path_wakati): continue
74
+ 8 f = open(path, "r")
75
+ ----> 9 text = f.read()
76
+ 10 words = ja_tokenize(text)
77
+ 11 wt = " ".join(words)
78
+
79
+ OSError: [Errno 22] Invalid argument
80
+ ```
62
81
  ```

1

詳細の追加

2018/04/26 09:43

投稿

James1201
James1201

スコア15

title CHANGED
@@ -1,1 +1,1 @@
1
- テキストファイルが開けません
1
+ 教科書の手順でのテキストファイルが開けません
body CHANGED
@@ -1,4 +1,5 @@
1
- 教科書の中のテキストを読み込むコードなのですが、テキストファイルを別のものにすると読み込めなくなりました。
1
+ 教科書の中のテキストを読み込むコードなのですが、テキストファイルを教科書内のものではない別のものにすると読み込めなくなりました。
2
+ やはりテキストデータの違いによるものなのでしょうか・・・、
2
3
 
3
4
  ```python
4
5
  from janome.tokenizer import Tokenizer
@@ -35,4 +36,27 @@
35
36
  words = ja_tokenize(text)
36
37
  wt = " ".join(words)
37
38
  open(path_wakati, "w", encoding="utf-8").write(wt)
39
+ ```
40
+ 混み込めていたテキスト一例
41
+ ./newstext
42
+ ![イメージ説明](9403b3dfbcb9452cf9c460fde5c8654b.png)
43
+ 読み込めなかったテキスト一例
44
+ ./Isojintext
45
+ ![イメージ説明](10de4ad82d2e87b46eff44d699ff26b8.png)
46
+
47
+ ### エラー内容
48
+ ```python
49
+ 0%| | 0/23 [00:00<?, ?it/s]
50
+ ./Isojintext/eq_0312.txt
51
+
52
+ ---------------------------------------------------------------------------
53
+ OSError Traceback (most recent call last)
54
+ <ipython-input-88-171f9eae8e3f> in <module>()
55
+ 6 path_wakati = path + ".wakati"
56
+ 7 if os.path.exists(path_wakati): continue
57
+ ----> 8 text = open(path,"r").read()
58
+ 9 words = ja_tokenize(text)
59
+ 10 wt = " ".join(words)
60
+
61
+ OSError: [Errno 22] Invalid argument
38
62
  ```