This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Jiao Lining <[email protected]> | |
# Date: 2020-01-22 | |
# Copyright (c) 2020, Thundercomm All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# * Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"> | |
<title>Register Cover | CORK - Multipurpose Bootstrap Dashboard Template </title> | |
<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico"/> | |
<!-- BEGIN GLOBAL MANDATORY STYLES --> | |
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jamspell | |
corrector = jamspell.TSpellCorrector() | |
corrector.LoadLangModel('en.bin') | |
print(corrector.FixFragment('I am the begt spell cherken!')) | |
# u'I am the best spell checker!' | |
print(corrector.GetCandidates(['i', 'am', 'the', 'begt', 'spell', 'cherken'], 3)) | |
# (u'best', u'beat', u'belt', u'bet', u'bent', ... ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Publisher | |
# In order to publish message we need a exchange name. | |
# Note that RabbitMQ does not care about the payload - | |
# we will be using JSON-encoded strings | |
def self.publish(exchange, message = {}) | |
# grab the fanout exchange | |
x = channel.fanout("dbcountermain#{exchange}") | |
# and simply publish message | |
x.publish(message.to_json) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Publisher | |
# In order to publish message we need a exchange name. | |
# Note that RabbitMQ does not care about the payload - | |
# we will be using JSON-encoded strings | |
def self.publish(exchange, message = {}) | |
# grab the fanout exchange | |
x = channel.fanout("dbcountermain#{exchange}") | |
# and simply publish message | |
x.publish(message.to_json) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Publisher | |
# In order to publish message we need a exchange name. | |
# Note that RabbitMQ does not care about the payload - | |
# we will be using JSON-encoded strings | |
def self.publish(exchange, message = {}) | |
# grab the fanout exchange | |
x = channel.fanout("dbcountermain#{exchange}") | |
# and simply publish message | |
x.publish(message.to_json) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text_file = spark.textFile("hdfs://...") | |
text_file.flatMap(lambda line: line.split()) | |
.map(lambda word: (word, 1)) | |
.reduceByKey(lambda a, b: a+b) |