File tree Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -106,28 +106,13 @@ public function getKeyValues()
106
106
*/
107
107
public function getHapaxes ()
108
108
{
109
- $ hapaxes = array ();
110
-
111
- //get the head key
112
- $ head = key ($ this ->keyValues );
113
-
114
- //get the tail value,. set the internal pointer to the tail
115
- $ tail = end ($ this ->keyValues );
116
- // no hapaxes available
117
- if ($ tail > 1 ) {
118
- return array ();
109
+ $ samples = array ();
110
+ foreach ($ this ->getKeyValues () as $ sample => $ count ) {
111
+ if ($ count == 1 ) {
112
+ $ samples [] = $ sample ;
119
113
}
120
-
121
- do {
122
- $ hapaxes [] = key ($ this ->keyValues );
123
- prev ($ this ->keyValues );
124
-
125
- } while (current ($ this ->keyValues ) == 1 && key ($ this ->keyValues ) !== $ head );
126
-
127
- //reset the internal pointer in the array
128
- reset ($ this ->keyValues );
129
-
130
- return $ hapaxes ;
114
+ }
115
+ return $ samples ;
131
116
}
132
117
133
118
}
You can’t perform that action at this time.
0 commit comments