回答編集履歴
4
修正
test
CHANGED
@@ -102,7 +102,7 @@
|
|
102
102
|
|
103
103
|
$a=array_map(function($x){
|
104
104
|
|
105
|
-
return preg_match("/^(.+)(?=
|
105
|
+
return preg_match("/^(.+?)(?=\s)/",$x,$match)?$match[1]:"";
|
106
106
|
|
107
107
|
},array_filter($output,function($x) use($keyword){
|
108
108
|
|
3
調整
test
CHANGED
@@ -102,7 +102,7 @@
|
|
102
102
|
|
103
103
|
$a=array_map(function($x){
|
104
104
|
|
105
|
-
return preg_match("/^(.+)(?=
|
105
|
+
return preg_match("/^(.+)(?=".chr(92)."s)/",$x,$match)?$match[1]:"";
|
106
106
|
|
107
107
|
},array_filter($output,function($x) use($keyword){
|
108
108
|
|
2
調整
test
CHANGED
@@ -84,15 +84,27 @@
|
|
84
84
|
|
85
85
|
# 修正
|
86
86
|
|
87
|
-
とりだしたあと、先頭の文字だけ抜き出す
|
87
|
+
- とりだしたあと、先頭の文字だけ抜き出す
|
88
|
+
|
89
|
+
- キーワードは工夫が必要
|
90
|
+
|
91
|
+
- $outputという変数を受けて処理する
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
もろもろ調整しました
|
96
|
+
|
97
|
+
|
88
98
|
|
89
99
|
```PHP
|
100
|
+
|
101
|
+
$keyword="名詞,固有名詞,地域";
|
90
102
|
|
91
103
|
$a=array_map(function($x){
|
92
104
|
|
93
105
|
return preg_match("/^(.+)(?=\s)/",$x,$match)?$match[1]:"";
|
94
106
|
|
95
|
-
},array_filter($
|
107
|
+
},array_filter($output,function($x) use($keyword){
|
96
108
|
|
97
109
|
return preg_match("/".preg_quote($keyword,"/")."/",$x);
|
98
110
|
|
1
修正
test
CHANGED
@@ -79,3 +79,25 @@
|
|
79
79
|
print_r($a);
|
80
80
|
|
81
81
|
```
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
# 修正
|
86
|
+
|
87
|
+
とりだしたあと、先頭の文字だけ抜き出す
|
88
|
+
|
89
|
+
```PHP
|
90
|
+
|
91
|
+
$a=array_map(function($x){
|
92
|
+
|
93
|
+
return preg_match("/^(.+)(?=\s)/",$x,$match)?$match[1]:"";
|
94
|
+
|
95
|
+
},array_filter($a,function($x) use($keyword){
|
96
|
+
|
97
|
+
return preg_match("/".preg_quote($keyword,"/")."/",$x);
|
98
|
+
|
99
|
+
}));
|
100
|
+
|
101
|
+
print_r($a);
|
102
|
+
|
103
|
+
```
|