eleutherai / dps Goto Github PK
View Code? Open in Web Editor NEWData processing system for polyglot
License: Apache License 2.0
Data processing system for polyglot
License: Apache License 2.0
soynlp
to normalize emotion characters.soynlp
library and customize normalize emotion
functionjapanese_spam_words_filter
as needed basis.japanese_reduce_emoticon
referring to the Korean one.with @Kaeun-Lee
there is memory error when deduplicate Chinese data.
23/04/19 19:44:17 WARN MemoryStore: Not enough space to cache rdd_7_0 in memory! (computed 176.2 MiB so far)
23/04/19 19:44:17 WARN BlockManager: Block rdd_7_0 could not be removed as it was not found on disk or in memory
23/04/19 19:44:17 WARN BlockManager: Putting block rdd_7_0 failed
23/04/19 19:44:17 WARN MemoryStore: Not enough space to cache rdd_7_2 in memory! (computed 176.2 MiB so far)
23/04/19 19:44:17 WARN BlockManager: Block rdd_7_2 could not be removed as it was not found on disk or in memory
23/04/19 19:44:17 WARN BlockManager: Putting block rdd_7_2 failed
23/04/19 19:44:17 WARN MemoryStore: Not enough space to cache rdd_7_9 in memory! (computed 176.3 MiB so far)
23/04/19 19:44:17 WARN BlockManager: Block rdd_7_9 could not be removed as it was not found on disk or in memory
23/04/19 19:44:17 WARN BlockManager: Putting block rdd_7_9 failed
23/04/19 19:44:19 WARN MemoryStore: Not enough space to cache rdd_7_7 in memory! (computed 176.6 MiB so far)
23/04/19 19:44:19 WARN BlockManager: Block rdd_7_7 could not be removed as it was not found on disk or in memory
23/04/19 19:44:19 WARN BlockManager: Putting block rdd_7_7 failed
23/04/19 19:44:41 WARN BlockManager: Block rdd_7_6 could not be removed as it was not found on disk or in memory
23/04/19 19:44:42 ERROR Executor: Exception in task 6.0 in stage 1.0 (TID 30545)
java.lang.OutOfMemoryError: Java heap space
bank account number | <|acc|> |
---|---|
credit number | <|crd|> |
{"text": "this is text"}
{"text": "this is text"}
{"text": "this is text"}
{"text": "this is text"}
{"text": "this is text"}
Hello I am getting this error while running dedup_job.
I am able to run sample_job and Korean_job but when I get this error in dedup_job.
I am using conda env, spark 3.0.1 with hadoop 2.7 with java SDK 8 on Windows. My system variables are set properly.
Need help
Kindly add a deduplication job for the Korean dataset.
py4j.protocol.Py4JJavaError: An error occurred while calling o52.partitions.
: java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$POSIX.stat(Ljava/lang/String;)Lorg/apache/hadoop/io/nativeio/NativeIO$POSIX$Stat;
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.stat(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$POSIX.getStat(NativeIO.java:608)
at org.apache.hadoop.fs.RawLocalFileSystem$DeprecatedRawLocalFileStatus.loadPermissionInfoByNativeIO(RawLocalFileSystem.java:934)
at org.apache.hadoop.fs.RawLocalFileSystem$DeprecatedRawLocalFileStatus.loadPermissionInfo(RawLocalFileSystem.java:848)
at org.apache.hadoop.fs.RawLocalFileSystem$DeprecatedRawLocalFileStatus.getPermission(RawLocalFileSystem.java:816)
at org.apache.hadoop.fs.LocatedFileStatus.<init>(LocatedFileStatus.java:52)
at org.apache.hadoop.fs.FileSystem$4.next(FileSystem.java:2199)
at org.apache.hadoop.fs.FileSystem$4.next(FileSystem.java:2179)
at org.apache.hadoop.mapred.FileInputFormat.singleThreadedListStatus(FileInputFormat.java:287)
at org.apache.hadoop.mapred.FileInputFormat.listStatus(FileInputFormat.java:244)
at org.apache.hadoop.mapred.FileInputFormat.getSplits(FileInputFormat.java:332)
at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:205)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:49)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.api.python.PythonRDD.getPartitions(PythonRDD.scala:55)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:49)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.ShuffleDependency.<init>(Dependency.scala:101)
at org.apache.spark.rdd.ShuffledRDD.getDependencies(ShuffledRDD.scala:87)
at org.apache.spark.rdd.RDD.$anonfun$dependencies$2(RDD.scala:264)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.dependencies(RDD.scala:260)
at org.apache.spark.rdd.ShuffledRDD.getPreferredLocations(ShuffledRDD.scala:98)
at org.apache.spark.rdd.RDD.$anonfun$preferredLocations$2(RDD.scala:324)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.preferredLocations(RDD.scala:324)
at org.apache.spark.scheduler.DAGScheduler.getPreferredLocsInternal(DAGScheduler.scala:2529)
at org.apache.spark.scheduler.DAGScheduler.getPreferredLocs(DAGScheduler.scala:2503)
at org.apache.spark.SparkContext.getPreferredLocs(SparkContext.scala:1898)
at org.apache.spark.rdd.DefaultPartitionCoalescer$PartitionLocations.$anonfun$getAllPrefLocs$1(CoalescedRDD.scala:198)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
at org.apache.spark.rdd.DefaultPartitionCoalescer$PartitionLocations.getAllPrefLocs(CoalescedRDD.scala:197)
at org.apache.spark.rdd.DefaultPartitionCoalescer$PartitionLocations.<init>(CoalescedRDD.scala:190)
at org.apache.spark.rdd.DefaultPartitionCoalescer.coalesce(CoalescedRDD.scala:391)
at org.apache.spark.rdd.CoalescedRDD.getPartitions(CoalescedRDD.scala:90)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:49)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.api.python.PythonRDD.getPartitions(PythonRDD.scala:55)
at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:300)
at scala.Option.getOrElse(Option.scala:189)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:296)
at org.apache.spark.api.java.JavaRDDLike.partitions(JavaRDDLike.scala:61)
at org.apache.spark.api.java.JavaRDDLike.partitions$(JavaRDDLike.scala:61)
at org.apache.spark.api.java.AbstractJavaRDDLike.partitions(JavaRDDLike.scala:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
at java.lang.Thread.run(Thread.java:748)
The function remove_repeated_text
shows unexpected behavior when the sentence is short.
Below is my test with the function.
{before} -> {after}
connue sous le nom de "mort par coeur brisé". -> connue sous brisé".
remontant à 150 ans, -> remontant à ans,
Je m'occupais des gens qui mouraient, et de leurs familles, -> Je m'occupais familles,
une femme qui mourait de démence. -> une femme démence.
qui prenait soin d'elle. -> qui prenait d'elle.
par exemple, pendant la première année. -> par exemple, année.
Ce qui m'est arrivé, c'est que je m'occupais d'une patiente, -> Ce qui patiente,
dans la banlieue sud de Chicago. -> dans la Chicago.
Dans mon labo, j'étudiais l'effet de veuvage, -> Dans mon veuvage,
tout au long de leur fin de vie. -> tout au vie.
c'est sa fille -> c'est sa fille
Et la fille était épuisée par les soins qu'elle apportait à sa mère. -> Et la mère.
Ainsi, quand je mourrai, le risque de décès de ma femme est doublé -> Ainsi, quand doublé
Pour moi, cette histoire a commencé il y a 15 ans, -> Pour moi, ans,
quand j'étais médecin en soins palliatifs à l'Université de Chicago. -> quand j'étais Chicago.
Et j'observais ce qui se passait pour ces gens et leurs familles -> Et j'observais familles
lui aussi était malade, -> lui aussi malade,
Et dans ce cas, contrairement à ce couple, -> Et dans couple,
qui est une très ancienne idée pour les sciences sociales, -> qui est sociales,
filter
method in RDD or DF, text like ""
need to be ignored during this process.filter
method after load the datai
On
dps/dps/spark/jobs/japanese_job.py
Lines 64 to 75 in bec4078
.filter
but instead it should be a .map
.
For example
dps/dps/spark/jobs/japanese_job.py
Line 73 in bec4078
dps/dps/spark/prep/japanese_prep.py
Lines 64 to 67 in bec4078
>>> def reduce_japanese_emoticon(text):
... text = re.sub("w{3,}", "www", text)
... text = re.sub("笑{2,}", "笑", text)
... return text
>>> rdd = sc.parallelize([{'text': 'wwwwasdf'}, {'text': '1234笑笑笑'}, {'text': ''}])
>>> rdd.filter(lambda x: reduce_japanese_emoticon(x['text'])).collect()
[{'text': 'wwwwasdf'}, {'text': '1234笑笑笑'}]
Thus, I think the following cases of .filter
are simply doing nothing instead of the intended preprocessing:
preprocess_text
on dps/dps/spark/jobs/japanese_job.py
Line 70 in bec4078
reduce_japanese_emoticon
on dps/dps/spark/jobs/japanese_job.py
Line 73 in bec4078
remove_symbols
on dps/dps/spark/jobs/japanese_job.py
Line 75 in bec4078
The remaining calls to methods that end with _filter
(e.g. japanese_bad_words_filter
, doc_len_filter
, etc.) are actually filter methods that return booleans so they should be OK.
How about adding some heuristic filters similar to MassiveText's Quality Filtering?
Could be helpful for web crawled datasets.
The numbers/values may vary depending on the language, though
with @DongChan-Lee
Deduplication: MinHash with jacaard similarity
URL / Email
for match in re.finditer("email" ... "url")
Replace HTML parser
Unicode correction (mac/linux => nfd
/ win => nfc
)
nfc => '가''발' (완성형)
nfd => 'ㄱ''ㅏ''ㅂ''ㅏ''ㄹ' => 옛 한글 (자모)
nfkc / nfkd => nfc / nfd랑 같으나 일부 글자들에서 차이가 있음.
ex) ㈆
nfc => '㈆'
nfkc => '(''ㅅ'')'
spam = ['무단배포금지', '무단전제금지']
spam not in re.sub("[ \n\r\t...등등]", "", text)
<phone_number>, <credit_card_number>
Data should be output as each categories.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.