FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Keras/TextApi.cs at master · feelsyt/TensorFlow.NET · GitHub
feelsyt
/
TensorFlow.NET
Public
forked from
SciSharp/TensorFlow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Keras
/
TextApi.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (32 loc) · 1.12 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Keras
/
TextApi.cs
Copy path
File metadata and controls
35 lines (32 loc) · 1.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Text
;
using
Tensorflow
.
Keras
.
Text
;
namespace
Tensorflow
.
Keras
{
public
class
TextApi
{
public
Tensorflow
.
Keras
.
Text
.
Tokenizer
Tokenizer
(
int
num_words
=
-
1
,
string
filters
=
DefaultFilter
,
bool
lower
=
true
,
char
split
=
' '
,
bool
char_level
=
false
,
string
oov_token
=
null
,
Func
<
string
,
IEnumerable
<
string
>
>
analyzer
=
null
)
{
return
new
Keras
.
Text
.
Tokenizer
(
num_words
,
filters
,
lower
,
split
,
char_level
,
oov_token
,
analyzer
)
;
}
public
static
IEnumerable
<
string
>
text_to_word_sequence
(
string
text
,
string
filters
=
DefaultFilter
,
bool
lower
=
true
,
char
split
=
' '
)
{
if
(
lower
)
{
text
=
text
.
ToLower
(
)
;
}
var
newText
=
new
String
(
text
.
Where
(
c
=>
!
filters
.
Contains
(
c
)
)
.
ToArray
(
)
)
;
return
newText
.
Split
(
split
)
;
}
private
const
string
DefaultFilter
=
"!
\"
#$%&()*+,-./:;<=>?@[
\\
]^_`{|}~
\t
\n
"
;
}
}
Back
|
FazBrowse Home
|
New Git URL